我正在使用Magical Record进行核心数据操作。
我在下面发布的崩溃似乎只发生在iOS 7中。 并且EXC_BAD_ACCESS KERN_INVALID_ADDRESS表示某个对象已取消分配。 我不太清楚bug在哪里。 有什么想法吗?感谢。
Thread : Crashed: NSManagedObjectContext Queue
0 libobjc.A.dylib 0x39d7c636 objc_msgSend + 21
1 Foundation 0x2fee4d9d -[NSError dealloc] + 60
2 libobjc.A.dylib 0x39d81b6b objc_object::sidetable_release(bool) + 174
3 libobjc.A.dylib 0x39d820d7 (anonymous namespace)::AutoreleasePoolPage::pop(void*) + 358
4 CoreFoundation 0x2f4f5c19 _CFAutoreleasePoolPop + 16
5 Foundation 0x2feef637 -[NSAutoreleasePool drain] + 122
6 CoreData 0x2f336fb9 -[NSManagedObjectContext save:] + 944
7 Branch 0x20f87d __70-[NSManagedObjectContext(MagicalSaves) MR_saveWithOptions:completion:]_block_invoke20 (NSManagedObjectContext+MagicalSaves.m:82)
8 CoreData 0x2f39a935 developerSubmittedBlockToNSManagedObjectContextPerform + 88
9 CoreData 0x2f39aa7b -[NSManagedObjectContext performBlockAndWait:] + 114
10 Branch 0x20f621 -[NSManagedObjectContext(MagicalSaves) MR_saveWithOptions:completion:] (NSManagedObjectContext+MagicalSaves.m:128)
11 CoreData 0x2f39a935 developerSubmittedBlockToNSManagedObjectContextPerform + 88
12 libdispatch.dylib 0x3a26cdd7 _dispatch_barrier_sync_f_invoke + 26
13 CoreData 0x2f39aa73 -[NSManagedObjectContext performBlockAndWait:] + 106
14 Branch 0x205831 +[MagicalRecord(Actions) saveWithBlockAndWait:] (MagicalRecord+Actions.m:44)
15 Branch 0x1acdbb __62-[BREmployeeDataController getPositionsAtLocation:completion:]_block_invoke (BREmployeeDataController.m:42)
16 Branch 0x1ad87d __66-[BREmployeeDataController synchronizeStaffAtLocation:completion:]_block_invoke (BREmployeeDataController.m:193)
17 Branch 0x1d215b __116-[AFHTTPSessionManager dataTaskWithHTTPMethod:URLString:parameters:uploadProgress:downloadProgress:success:failure:]_block_invoke80 (AFHTTPSessionManager.m:287)
18 Branch 0x1e326b __72-[AFURLSessionManagerTaskDelegate URLSession:task:didCompleteWithError:]_block_invoke_2150 (AFURLSessionManager.m:308)
19 libdispatch.dylib 0x3a25a833 _dispatch_call_block_and_release + 10
20 libdispatch.dylib 0x3a25a81f _dispatch_client_callout + 22
21 libdispatch.dylib 0x3a25a777 _dispatch_main_queue_callback_4CF$VARIANT$up + 254
22 CoreFoundation 0x2f58c8a1 __CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__ + 8
23 CoreFoundation 0x2f58b175 __CFRunLoopRun + 1300
24 CoreFoundation 0x2f4f5ebf CFRunLoopRunSpecific + 522
25 CoreFoundation 0x2f4f5ca3 CFRunLoopRunInMode + 106
26 GraphicsServices 0x343fb663 GSEventRunModal + 138
27 UIKit 0x31e4214d UIApplicationMain + 1136
28 Branch 0x1a6437 main (main.m:14)
29 libdyld.dylib 0x3a27fab7 start + 2
答案 0 :(得分:1)
你在使用ARC吗? MagicalRecord是否使用ARC?
您或MagicalRecord过度释放NSAutoreleasePool认为它拥有的某个对象。然后弹出池(当你的NSManagedObjectContext完成save:操作时),其中一个对象是垃圾。尝试在启用NSZombies的情况下运行,或使用分配工具确定哪个对象被过度释放。