我使用RestKit将Doctor对象发布到服务器,然后将对象保存在成功块中
在调试版中,它适用于我。即使在发布版本(我使用内部发布),大多数时候它也运行良好。当发生死锁时,无论我杀了什么应用程序并重新启动它都会发生
但是当我删除并重新安装它(使用相同的版本)时,它再次正常工作。这太奇怪了,我无法理解!
我在CocoaPods中使用最新的RestKit(0.23.3)和MagicalRecord(2.2)。
以下是代码:
[[AccountManager cloudDataManager] postWithData:self path:path control:nil success:^(RKObjectRequestOperation *operation, id data) {
self.doctorId = [data valueForKey:DoctorsAttributes.doctorId];
[[self managedObjectContext] MR_saveToPersistentStoreWithCompletion:^(BOOL success, NSError *error) {
NSAssert(error == nil, ([NSString stringWithFormat:@"%@", error]));
if (handler != NULL) {
handler();
}
}];
} error:self.error failure:self.failureWithNotice];
以下是错误消息:
Date/Time: 2014-08-26 11:16:43.368 +0800
OS Version: iOS 7.1.2 (11D257)
Report Version: 104
Exception Type: 00000020
Exception Codes: 0x000000008badf00d
Highlighted Thread: 0
Application Specific Information:
com.cvte.visiomed.inhouse.bewellConnect failed to resume in time
Elapsed total CPU time (seconds): 12.360 (user 12.360, system 0.000), 62% CPU
Elapsed application CPU time (seconds): 4.927, 25% CPU
Thread 0:
0 libobjc.A.dylib 0x3902c627 objc_msgSend + 7
1 Foundation 0x2f1af029 -[NSError dealloc] + 57
2 libobjc.A.dylib 0x39031b67 objc_object::sidetable_release(bool) + 171
3 libobjc.A.dylib 0x390320cf (anonymous namespace)::AutoreleasePoolPage::pop(void*) + 355
4 CoreFoundation 0x2e7bf47d _CFAutoreleasePoolPop + 13
5 Foundation 0x2f1b98df -[NSAutoreleasePool drain] + 119
6 CoreData 0x2e5fffbb -[NSManagedObjectContext save:] + 939
7 BeWellConnect 0x002a6c27 0xc6000 + 1969191
8 CoreData 0x2e6639cb developerSubmittedBlockToNSManagedObjectContextPerform + 87
9 libdispatch.dylib 0x3950bd3d _dispatch_client_callout + 21
10 libdispatch.dylib 0x3950e6bf _dispatch_main_queue_callback_4CF + 275
11 CoreFoundation 0x2e85663d __CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__ + 5
12 CoreFoundation 0x2e854f09 __CFRunLoopRun + 1305
13 CoreFoundation 0x2e7bf725 CFRunLoopRunSpecific + 521
14 CoreFoundation 0x2e7bf507 CFRunLoopRunInMode + 103
15 GraphicsServices 0x3371e6cf GSEventRunModal + 135
16 UIKit 0x3112086d UIApplicationMain + 1133
17 BeWellConnect 0x0013716f 0xc6000 + 463215
18 libdyld.dylib 0x39520ab5 start + 1
答案 0 :(得分:0)
当核心数据模型发生变化时,会发生这种情况。
在设置MR之前,我们应该调用[MagicalRecord setShouldDeleteStoreOnModelMismatch:YES];
因为MR不会删除默认版本中的数据