創建NSFetchedResultsController對象時越來越objc_exception_throw創建NSFetchedResultsController
編輯
NSFetchRequest *fetchRequest = [[NSFetchRequest alloc] init];
// Edit the entity name as appropriate.
NSEntityDescription *entity = [NSEntityDescription entityForName:@"Subscriptions" inManagedObjectContext:self.managedObjectContext];
[fetchRequest setEntity:entity];
// Set the batch size to a suitable number.
[fetchRequest setFetchBatchSize:20];
編輯結束
NSFetchedResultsController *aFetchedResultsController = [[NSFetchedResultsController alloc] initWithFetchRequest:fetchRequest managedObjectContext:self.managedObjectContext sectionNameKeyPath:nil cacheName:nil];
#0 0x977109c6 in __pthread_kill()
#1 0x96296f78 in pthread_kill()
#2 0x96287bdd in abort()
#3 0x0022eb71 in uncaught_exception_handler()
#4 0x024b70fc in __handleUncaughtException()
#5 0x0264af0f in _objc_terminate()
#6 0x052fb8de in safe_handler_caller()
#7 0x052fb946 in std::terminate()
#8 0x052fcab2 in __cxa_throw()
#9 0x0264ade1 in objc_exception_throw()
#10 0x00617f39 in -[NSFetchedResultsController initWithFetchRequest:managedObjectContext:sectionNameKeyPath:cacheName:]()
任何想法,我應該開始我收到以下錯誤,當尋找問題。這個錯誤沒有任何幫助。
我已經放了一個斷點並已經檢查了輸入 init函數有兩個輸入,一個是管理對象,第二個是獲取請求。
這兩個對象都是有效的,不像下面的答案中提到的那樣。
** **解決方案 看來,排序描述符是強制性的,感謝羅格
您可以發佈在控制檯中打印的異常消息嗎? – 2012-08-14 16:23:25
在該行放置一個斷點。檢查'initWith ...'的所有輸入是否有效。 – Mundi 2012-08-14 16:47:40
@mundi檢查我的編輯請 – Anand 2012-08-16 11:28:16