1
我面臨一個奇怪的問題,當我的應用程序在調用後刪除記錄時發生崩潰[context save:& error]方法。我隨機得到這個問題,當它發生時,我在控制檯上看到沒有例外。應用程序崩潰在[上下文保存:&錯誤](在刪除記錄後)
問候 穆罕默德·阿米爾
我面臨一個奇怪的問題,當我的應用程序在調用後刪除記錄時發生崩潰[context save:& error]方法。我隨機得到這個問題,當它發生時,我在控制檯上看到沒有例外。應用程序崩潰在[上下文保存:&錯誤](在刪除記錄後)
問候 穆罕默德·阿米爾
在接口文件
@property (nonatomic, retain) NSFetchedResultsController *fetchedResultsController;
@property (nonatomic, retain) NSManagedObjectContext *managedObjectContext;
在實現文件
@synthesize fetchedResultsController=__fetchedResultsController;
@synthesize managedObjectContext=__managedObjectContext;
- (void)dealloc
{
[__managedObjectContext release];
[__fetchedResultsController release];
[super dealloc];
}
使用此代碼的實現代碼如下刪除
NSManagedObjectContext *context =
[self.fetchedResultsController managedObjectContext];
[context deleteObject:[self.fetchedResultsController objectAtIndexPath:indexPath]];
// Save the context.
NSError *error = nil;
if (![context save:&error])
{
NSLog(@"Unresolved error %@, %@", error, [error userInfo]);
abort();
}
請問您可以擴展您的問題,提供有關報告的錯誤的詳細信息,代碼的相關代碼段以及可能有用的任何其他信息,以便爲您提供有意義的答案? (例如,你如何「刪除記錄」?) – magma 2011-04-28 08:34:22
錯誤是如何處理的? Apple的核心數據模板使用abort();.這將導致「崩潰」。用'[error userInfo]'記錄錯誤的更多細節。 – 2011-04-28 15:58:39