打了个全局断点,发现进入到\XMPPCoreDataStorage.h的头文件的managedObjectContext方法的实现上面 上面有错误说明
大概是这不是安全的context在线程里面(non thread safe)
这时候发现原来在好友列表FetchedResultsController加载方法中,用错了该context
错误:NSEntityDescription *entity = [NSEntityDescription entityForName:@"XMPPUserCoreDataStorageObject.h" inManagedObjectContext:[XMPPRosterCoreDataStorage sharedInstance].managedObjectContext];
正确: NSEntityDescription *entity = [NSEntityDescription entityForName:@"XMPPUserCoreDataStorageObject.h" inManagedObjectContext:[XMPPRosterCoreDataStorage sharedInstance].mainThreadManagedObjectContext];