Ios 核心数据删除对象崩溃应用程序,EXC\u访问错误
我正在从fetchResultsController加载一个用户对象,从该用户那里获取一组相关的站点对象,将它们放入数组,排序,然后在UITableView中显示Ios 核心数据删除对象崩溃应用程序,EXC\u访问错误,ios,iphone,cocoa-touch,core-data,Ios,Iphone,Cocoa Touch,Core Data,我正在从fetchResultsController加载一个用户对象,从该用户那里获取一组相关的站点对象,将它们放入数组,排序,然后在UITableView中显示 -(void)loadMainUser { id <NSFetchedResultsSectionInfo> sectionInfo = [[self.fetchedResultsController sections] objectAtIndex:0]; if([sectionInfo numberOfObjects
-(void)loadMainUser {
id <NSFetchedResultsSectionInfo> sectionInfo = [[self.fetchedResultsController sections] objectAtIndex:0];
if([sectionInfo numberOfObjects]) {
NSUInteger indexArr[] = {0,0};
NSIndexPath *indexSet = [NSIndexPath indexPathWithIndexes:indexArr length:2];
mainUser = (User *)[self.fetchedResultsController objectAtIndexPath:indexSet];
NSSortDescriptor *sortDescriptor = [[NSSortDescriptor alloc] initWithKey:@"siteName" ascending:YES selector:@selector(caseInsensitiveCompare:)];
NSArray *sortDescriptors = [[NSArray alloc] initWithObjects:&sortDescriptor count:1];
sortedMsgs = [[mainUser.sitesToUser allObjects] mutableCopy];
[sortedMsgs sortUsingDescriptors:sortDescriptors];
[sortDescriptor release];
[sortDescriptors release];
}
[self.theTableView reloadData];
}
我不太清楚为什么。。。我注意到我的主用户有一个保留计数3,我认为这是因为SorterDMSG和UITableView。。。是否因为我的UITableView仍然显示来自用户的数据,然后我将其删除?真的很困惑
以下是崩溃日志:
Exception Type: EXC_BAD_ACCESS (SIGBUS)
Exception Codes: KERN_PROTECTION_FAILURE at 0x0000000000000016
Crashed Thread: 0 Dispatch queue: com.apple.main-thread
Application Specific Information:
objc_msgSend() selector name: isTemporaryID
iPhone Simulator 235, iPhone OS 4.2 (iPhone/8C134)
Thread 0 Crashed: Dispatch queue: com.apple.main-thread
0 libobjc.A.dylib 0x01613a63 objc_msgSend + 23
1 CoreData 0x00e20d26 -[NSManagedObjectContext save:] + 566
2 Clicky 0x00002cfd -[RootViewController deleteUser] + 358 (RootViewController.m:71)
3 UIKit 0x003eaa6e -[UIApplication sendAction:to:from:forEvent:] + 119
4 UIKit 0x005f8167 -[UIBarButtonItem(UIInternal) _sendAction:withEvent:] + 156
5 UIKit 0x003eaa6e -[UIApplication sendAction:to:from:forEvent:] + 119
6 UIKit 0x004791b5 -[UIControl sendAction:to:forEvent:] + 67
我在这一点上的唯一猜测是,您可能正在删除一个与另一个对象具有必需关系的对象。检查数据模型中的关系
完全是一种预感。我现在唯一的猜测是,您可能正在删除一个与另一个对象具有必需关系的对象。检查数据模型中的关系 完全是一种预感
Exception Type: EXC_BAD_ACCESS (SIGBUS)
Exception Codes: KERN_PROTECTION_FAILURE at 0x0000000000000016
Crashed Thread: 0 Dispatch queue: com.apple.main-thread
Application Specific Information:
objc_msgSend() selector name: isTemporaryID
iPhone Simulator 235, iPhone OS 4.2 (iPhone/8C134)
Thread 0 Crashed: Dispatch queue: com.apple.main-thread
0 libobjc.A.dylib 0x01613a63 objc_msgSend + 23
1 CoreData 0x00e20d26 -[NSManagedObjectContext save:] + 566
2 Clicky 0x00002cfd -[RootViewController deleteUser] + 358 (RootViewController.m:71)
3 UIKit 0x003eaa6e -[UIApplication sendAction:to:from:forEvent:] + 119
4 UIKit 0x005f8167 -[UIBarButtonItem(UIInternal) _sendAction:withEvent:] + 156
5 UIKit 0x003eaa6e -[UIApplication sendAction:to:from:forEvent:] + 119
6 UIKit 0x004791b5 -[UIControl sendAction:to:forEvent:] + 67