2011-03-20 2 views
4

d'abord l'arrière-plan:accident CoreData sur mergeChangesFromContextDidSaveNotification: invalide Résumé

J'ai un singleton qui fait tout mon CoreData choses liées à ce sujet. Il est appelé à partir de plusieurs threads. Pour chaque thread, je génère un nouveau MOC en utilisant toujours le même StoreCoordinator. J'ai deux fetchedResultsController qui doivent être mis à jour dès que les données changent sur un autre thread. Pour fusionner les modifications, j'appelle addControllerContextDidSave: comme dans l'application de démonstration de livres.

- (void)addControllerContextDidSave:(NSNotification*)saveNotification { 
    if (saveNotification) { 
     NSManagedObjectContext *fahrzeugeContext = [fetchedFahrzeuge managedObjectContext]; 
     NSManagedObjectContext *accountContext = [fetchedAccount managedObjectContext]; 
     // Merging changes causes the fetched results controller to update its results 
     @try { 
      if (fahrzeugeContext) [fahrzeugeContext mergeChangesFromContextDidSaveNotification:saveNotification]; 
      if (accountContext) [accountContext mergeChangesFromContextDidSaveNotification:saveNotification]; 
     } 
     @catch (NSException * e) {NSLog(@"Merge Notification Error: %@", e);} 
    } 
} 

Dans certains cas très rares, l'application se bloque avec une EXC_BAD_ACCESS en ligne mergeChangesFromContextDidSaveNotification: disant que le saveNotification a un invalid Summary. (Même le bloc try-catch ne fonctionne pas)
Cela n'arrive que sur des situations vraiment très rares (par exemple une fois par semaine) donc je ne peux pas le tester correctement.

Ce qui peut causer cela et plus important comment le réparer. Maintenant, je suis en train de tester avec if (saveNotification) {} mais encore une fois, il peut prendre un certain temps jusqu'à ce qu'il se reproduise.

enter image description here

.

EDIT: a trouvé un journal crash ancien appareil:

Incident Identifier: 655DB451-81C1-41A6-942C-F54DD9F40FCC 
CrashReporter Key: 2495494089df0a2b47c6283c14ad5f8e7895fbbe 
Hardware Model:  iPhone1,2 
Process:   MyApp [648] 
Path:   /var/mobile/Applications/43E12C67-7D7D-4F30-A7E3-D83DDE0FDCC1/MyApp.app/MyApp 
Identifier:  MyApp 
Version:   ??? (???) 
Code Type:  ARM (Native) 
Parent Process: launchd [1] 

Date/Time:  2011-02-25 13:33:30.232 +0100 
OS Version:  iPhone OS 4.2.1 (8C148) 
Report Version: 104 

Exception Type: EXC_BAD_ACCESS (SIGBUS) 
Exception Codes: KERN_PROTECTION_FAILURE at 0x00000004 
Crashed Thread: 8 

Thread 0: 
0 libSystem.B.dylib    0x35d5b4a0 swtch_pri + 8 
1 libSystem.B.dylib    0x35de59c8 sched_yield + 8 
2 UIKit       0x35a60c18 -[UITableView(_UITableViewPrivate) _smoothScroll:] + 20 
3 UIKit       0x35a4a4a0 ScrollerHeartbeatCallback + 100 
4 GraphicsServices    0x33e79a3c HeartbeatVBLCallback + 152 
5 IOMobileFramebuffer    0x3027d864 IOMobileFramebufferVsyncNotifyFunc + 124 
6 IOKit       0x307dc884 IODispatchCalloutFromCFMessage + 292 
7 CoreFoundation     0x37537e30 __CFMachPortPerform + 212 
8 CoreFoundation     0x3752f5c4 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE1_PERFORM_FUNCTION__ + 22 
9 CoreFoundation     0x3752f582 __CFRunLoopDoSource1 + 158 
10 CoreFoundation     0x3752182e __CFRunLoopRun + 574 
11 CoreFoundation     0x37521504 CFRunLoopRunSpecific + 220 
12 CoreFoundation     0x37521412 CFRunLoopRunInMode + 54 
13 GraphicsServices    0x33e76d1c GSEventRunModal + 188 
14 UIKit       0x3591d574 -[UIApplication _run] + 580 
15 UIKit       0x3591a550 UIApplicationMain + 964 
16 MyApp       0x000177ae 0x1000 + 92078 
17 MyApp       0x00002f68 0x1000 + 8040 

Thread 1: 
0 libSystem.B.dylib    0x35d8f974 kevent + 24 
1 libSystem.B.dylib    0x35e5e2fc _dispatch_mgr_invoke + 88 
2 libSystem.B.dylib    0x35e5dd68 _dispatch_queue_invoke + 96 
3 libSystem.B.dylib    0x35e5d788 _dispatch_worker_thread2 + 120 
4 libSystem.B.dylib    0x35de6970 _pthread_wqthread + 392 
5 libSystem.B.dylib    0x35ddd2fc start_wqthread + 0 

Thread 2: 
0 libSystem.B.dylib    0x35d5b3b0 mach_msg_trap + 20 
1 libSystem.B.dylib    0x35d5d894 mach_msg + 60 
2 CoreFoundation     0x37521f7c __CFRunLoopServiceMachPort + 88 
3 CoreFoundation     0x37521780 __CFRunLoopRun + 400 
4 CoreFoundation     0x37521504 CFRunLoopRunSpecific + 220 
5 CoreFoundation     0x37521412 CFRunLoopRunInMode + 54 
6 WebCore       0x3318bd14 RunWebThread(void*) + 524 
7 libSystem.B.dylib    0x35de5b44 _pthread_start + 364 
8 libSystem.B.dylib    0x35dd77a4 thread_start + 0 

Thread 3: 
0 libSystem.B.dylib    0x35d5b3b0 mach_msg_trap + 20 
1 libSystem.B.dylib    0x35d5d894 mach_msg + 60 
2 CoreFoundation     0x37521f7c __CFRunLoopServiceMachPort + 88 
3 CoreFoundation     0x37521780 __CFRunLoopRun + 400 
4 CoreFoundation     0x37521504 CFRunLoopRunSpecific + 220 
5 CoreFoundation     0x37521412 CFRunLoopRunInMode + 54 
6 Foundation      0x3517ec4e +[NSURLConnection(NSURLConnectionReallyInternal) _resourceLoadLoop:] + 210 
7 Foundation      0x3515cb8a -[NSThread main] + 42 
8 Foundation      0x35155b90 __NSThread__main__ + 908 
9 libSystem.B.dylib    0x35de5b44 _pthread_start + 364 
10 libSystem.B.dylib    0x35dd77a4 thread_start + 0 

Thread 4: 
0 libSystem.B.dylib    0x35d848d8 select$DARWIN_EXTSN + 20 
1 CoreFoundation     0x3755aa34 __CFSocketManager + 356 
2 libSystem.B.dylib    0x35de5b44 _pthread_start + 364 
3 libSystem.B.dylib    0x35dd77a4 thread_start + 0 

Thread 5: 
0 libSystem.B.dylib    0x35de72fc __workq_kernreturn + 8 
1 libSystem.B.dylib    0x35de6b50 _pthread_wqthread + 872 
2 libSystem.B.dylib    0x35ddd2fc start_wqthread + 0 

Thread 6: 
0 libSystem.B.dylib    0x35d5b3b0 mach_msg_trap + 20 
1 libSystem.B.dylib    0x35d5d894 mach_msg + 60 
2 CoreFoundation     0x37521f7c __CFRunLoopServiceMachPort + 88 
3 CoreFoundation     0x37521780 __CFRunLoopRun + 400 
4 CoreFoundation     0x37521504 CFRunLoopRunSpecific + 220 
5 CoreFoundation     0x37521412 CFRunLoopRunInMode + 54 
6 MapKit       0x3627ec44 TileCachePrivate::runCacheThread() + 412 
7 MapKit       0x3627ea98 _runCacheThread(void*) + 4 
8 libSystem.B.dylib    0x35de5b44 _pthread_start + 364 
9 libSystem.B.dylib    0x35dd77a4 thread_start + 0 

Thread 7: 
0 libSystem.B.dylib    0x35de454c __semwait_signal + 24 
1 libSystem.B.dylib    0x35d90f70 _pthread_cond_wait + 1140 
2 libSystem.B.dylib    0x35d90910 pthread_cond_wait + 48 
3 QuartzCore      0x33dd01fc CA::DispatchGroup::thread(void*) + 128 
4 QuartzCore      0x33d86e30 thread_fun + 20 
5 libSystem.B.dylib    0x35de5b44 _pthread_start + 364 
6 libSystem.B.dylib    0x35dd77a4 thread_start + 0 

Thread 8 Crashed: 
0 CoreFoundation     0x374ffa7c ___CFBasicHashFindBucket_Linear + 120 
1 CoreFoundation     0x374ff948 CFBasicHashAddValue + 352 
2 CoreFoundation     0x3750410a CFSetAddValue + 90 
3 CoreFoundation     0x3752be2a -[__NSCFSet addObject:] + 34 
4 CoreData      0x34994b72 -[NSManagedObjectContext refreshObject:mergeChanges:] + 166 
5 CoreData      0x349b3288 -[NSManagedObjectContext mergeChangesFromContextDidSaveNotification:] + 1800 
6 MyApp       0x0001aa18 0x1000 + 104984 
7 Foundation      0x351663ae _nsnote_callback + 150 
8 CoreFoundation     0x3752096a __CFXNotificationPost_old + 390 
9 CoreFoundation     0x3752060a _CFXNotificationPostNotification + 122 
10 Foundation      0x3515569c -[NSNotificationCenter postNotificationName:object:userInfo:] + 64 
11 CoreData      0x349a0a68 -[NSManagedObjectContext(_NSInternalAdditions) _didSaveChanges] + 1772 
12 CoreData      0x3499b87a -[NSManagedObjectContext save:] + 462 
13 MyApp       0x00018e26 0x1000 + 97830 
14 MyApp       0x0001a372 0x1000 + 103282 
15 MyApp       0x00005344 0x1000 + 17220 
16 Foundation      0x3515cb8a -[NSThread main] + 42 
17 Foundation      0x35155b90 __NSThread__main__ + 908 
18 libSystem.B.dylib    0x35de5b44 _pthread_start + 364 
19 libSystem.B.dylib    0x35dd77a4 thread_start + 0 

Thread 8 crashed with ARM Thread State: 
    r0: 0x00000001 r1: 0x0018be57  r2: 0x0020fdc8  r3: 0x00000001 
    r4: 0x00000002 r5: 0x001cde10  r6: 0x00000007  r7: 0x2ff780b8 
    r8: 0x00000001 r9: 0x2ff780e0  r10: 0x001ce3e0  r11: 0x00000000 
    ip: 0x3752be09 sp: 0x2ff78074  lr: 0x374ffa50  pc: 0x374ffa7c 
    cpsr: 0x20000010 

Binary Images: 
    0x1000 - 0x40fff +MyApp armv6 <1515b6768d3049d6eef946a5e74e95ed> /var/mobile/Applications/43E12C67-7D7D-4F30-A7E3-D83DDE0FDCC1/GPS-Explorer.app/GPS-Explorer 
    0xe3000 - 0xe4fff dns.so armv6 <88b569311cca4a9593b2d670051860d1> /usr/lib/info/dns.so 
0x2fe00000 - 0x2fe29fff dyld armv6 <617f6daf4103547c47a8407a2e0b90de> /usr/lib/dyld 
0x30270000 - 0x3027bfff ITSync armv6 <a451205e89373cbdf0832688085e8f72> /System/Library/PrivateFrameworks/ITSync.framework/ITSync 
0x3027c000 - 0x3027efff IOMobileFramebuffer armv6 <f42bbbf67195a7b98d67ad021bba4784> /System/Library/PrivateFrameworks/IOMobileFramebuffer.framework/IOMobileFramebuffer 
0x3027f000 - 0x3038dfff CFNetwork armv6 <d6eeee83216ee9c553134f069f37cbc2> /System/Library/Frameworks/CFNetwork.framework/CFNetwork 
0x303ef000 - 0x303f4fff CaptiveNetwork armv6 <f41df4b358b77b29ff85e0eaea88ee1d> /System/Library/PrivateFrameworks/CaptiveNetwork.framework/CaptiveNetwork 
0x303f5000 - 0x30444fff Security armv6 <cf625b4dc7ea928891313444ef64a7cb> /System/Library/Frameworks/Security.framework/Security 
0x30445000 - 0x3055cfff libicucore.A.dylib armv6 <8968ff3f62d7780bb1bd75026a7628d0> /usr/lib/libicucore.A.dylib 
0x3055d000 - 0x30561fff ApplePushService armv6 <0560b630d26e261e205fc58942e1885c> /System/Library/PrivateFrameworks/ApplePushService.framework/ApplePushService 
0x3059d000 - 0x305a8fff MobileWiFi armv6 <c7532e63e083a1dd2a0ef7352b85749d> /System/Library/PrivateFrameworks/MobileWiFi.framework/MobileWiFi 
0x305aa000 - 0x30612fff libvDSP.dylib armv6 <9d264733fc675943c082bd3b9b567b59> /System/Library/Frameworks/Accelerate.framework/Frameworks/vecLib.framework/libvDSP.dylib 
0x30613000 - 0x3064dfff MobileCoreServices armv6 <beb473ce80390554bb4af21554522286> /System/Library/Frameworks/MobileCoreServices.framework/MobileCoreServices 
0x3065c000 - 0x3066efff libbsm.0.dylib armv6 <51e7bb18da9afa44a33e54e42fbd0707> /usr/lib/libbsm.0.dylib 
0x3066f000 - 0x306c6fff CoreMedia armv6 <cd5e9398c161f129146931e888e1c92e> /System/Library/Frameworks/CoreMedia.framework/CoreMedia 
0x306f0000 - 0x306fefff libz.1.dylib armv6 <84592e96bae1a661374b0f9a5d03a3a0> /usr/lib/libz.1.dylib 
0x306ff000 - 0x30729fff PrintKit armv6 <74f9710fa01a33b5bb04c4aeabd6be7d> /System/Library/PrivateFrameworks/PrintKit.framework/PrintKit 
0x307d7000 - 0x3082afff IOKit armv6 <20da5e822f21a8d0a7c5b3e149330efd> /System/Library/Frameworks/IOKit.framework/Versions/A/IOKit 
0x30831000 - 0x3083bfff AccountSettings armv6 <eca67ab04f724e1fa7c6406c88e75433> /System/Library/PrivateFrameworks/AccountSettings.framework/AccountSettings 
0x30999000 - 0x309c5fff DataAccess armv6 <8c045822d57a369835f5b40653a48838> /System/Library/PrivateFrameworks/DataAccess.framework/DataAccess 
0x309c6000 - 0x309f4fff MIME armv6 <fac8f55c508ff476e07894af7abdb761> /System/Library/PrivateFrameworks/MIME.framework/MIME 
0x30a04000 - 0x30aa3fff ProofReader armv6 <2734920b62f174c17aeeb15f371615ef> /System/Library/PrivateFrameworks/ProofReader.framework/ProofReader 
0x30ad6000 - 0x30b1afff AddressBook armv6 <1f30c3370dad27331a491ba4b190813c> /System/Library/Frameworks/AddressBook.framework/AddressBook 
0x30b3d000 - 0x30b9cfff CoreAudio armv6 <ccc4bace0d6eca79a32ed84d566f72e9> /System/Library/Frameworks/CoreAudio.framework/CoreAudio 
0x30ba6000 - 0x32ce3fff TextInput armv6 <3fa14e6e5749e0230becd6ea34a8da7a> /System/Library/PrivateFrameworks/TextInput.framework/TextInput 
0x32d7d000 - 0x32d89fff libkxld.dylib armv6 <f74f359de7bbe3ccdc37fa6f332aebf4> /usr/lib/system/libkxld.dylib 
0x32d95000 - 0x32e5cfff libobjc.A.dylib armv6 <429841269f8bcecd4ba3264a8725dad6> /usr/lib/libobjc.A.dylib 
0x32e5d000 - 0x32ecdfff libsqlite3.dylib armv6 <87b9bb47687902d9120d03d1da9eb9fc> /usr/lib/libsqlite3.dylib 
0x32f0c000 - 0x32f1ffff libmis.dylib armv6 <dba9c086b49bd9540930ff27211570d6> /usr/lib/libmis.dylib 
0x33055000 - 0x33061fff SpringBoardServices armv6 <fd0c472436b3306f5b56118c93c8a423> /System/Library/PrivateFrameworks/SpringBoardServices.framework/SpringBoardServices 
0x33062000 - 0x3306ffff MobileBluetooth armv6 <2b68516e11a4efbee2947d463c6> /System/Library/PrivateFrameworks/MobileBluetooth.framework/MobileBluetooth 
0x33070000 - 0x338bffff WebCore armv6 <aa3b6827f051da7a3494c9bee4ebe290> /System/Library/PrivateFrameworks/WebCore.framework/WebCore 
0x338c0000 - 0x338d4fff MobileDeviceLink armv6 <19d66078f8cf19be558713c13612c7a3> /System/Library/PrivateFrameworks/MobileDeviceLink.framework/MobileDeviceLink 
0x338d5000 - 0x33a1dfff libmecabra.dylib armv6 <fc962eeb4e6cfe4ad5ebee6fb4b1d5c1> /usr/lib/libmecabra.dylib 
0x33a21000 - 0x33a6afff CoreLocation armv6 <a69399375024b2bfae8bb96e845f4fd0> /System/Library/Frameworks/CoreLocation.framework/CoreLocation 
0x33a6b000 - 0x33ab3fff iCalendar armv6 <fbb717874ea0ede24454a5def644ab69> /System/Library/PrivateFrameworks/iCalendar.framework/iCalendar 
0x33ab4000 - 0x33ab4fff Accelerate armv6 <cdde24a7ad004b2b2e600cd4f3ac5eb7> /System/Library/Frameworks/Accelerate.framework/Accelerate 
0x33b32000 - 0x33b72fff QuickLook armv6 <54400e0d48ec86c84e937e55790b9e54> /System/Library/Frameworks/QuickLook.framework/QuickLook 
0x33bbc000 - 0x33c0afff CoreText armv6 <16c9582fdffb598178287c6ce9fd6897> /System/Library/Frameworks/CoreText.framework/CoreText 
0x33c16000 - 0x33d73fff libGLProgrammability.dylib armv6 <aec6b54ffd532bb607aab4acbab679b6> /System/Library/Frameworks/OpenGLES.framework/libGLProgrammability.dylib 
0x33d76000 - 0x33d79fff ActorKit armv6 <d3ec50b4a7f0257ef31baf37936dc275> /System/Library/PrivateFrameworks/ActorKit.framework/ActorKit 
0x33d85000 - 0x33e71fff QuartzCore armv6 <77cd91ff21fe6c58c309f2c82eb95ca5> /System/Library/Frameworks/QuartzCore.framework/QuartzCore 
0x33e72000 - 0x33e81fff GraphicsServices armv6 <af20aba0ec96e7b7c42bb55ac763c784> /System/Library/PrivateFrameworks/GraphicsServices.framework/GraphicsServices 
0x33ead000 - 0x33f6efff ImageIO armv6 <0c1b6f466667ff345f2399d8142a9d10> /System/Library/Frameworks/ImageIO.framework/ImageIO 
0x33f78000 - 0x33f79fff CoreSurface armv6 <5e290514380c626e9b0f9f9985b9dc7a> /System/Library/PrivateFrameworks/CoreSurface.framework/CoreSurface 
0x340ac000 - 0x340bffff Notes armv6 <acf9e548948ecb299270c8398ef297a1> /System/Library/PrivateFrameworks/Notes.framework/Notes 
0x34137000 - 0x34156fff EAP8021X armv6 <fa56845b5396c3ebb368c2368331643c> /System/Library/PrivateFrameworks/EAP8021X.framework/EAP8021X 
0x341ad000 - 0x341ebfff ContentIndex armv6 <7f3334380acc72292571803f0b490189> /System/Library/PrivateFrameworks/ContentIndex.framework/ContentIndex 
0x343a0000 - 0x343bffff Bom armv6 <f41bef81e23e2bff59155e5ce46762d3> /System/Library/PrivateFrameworks/Bom.framework/Bom 
0x343c0000 - 0x344bdfff JavaScriptCore armv6 <3547c92c1efc0522b087e7f10eba7728> /System/Library/PrivateFrameworks/JavaScriptCore.framework/JavaScriptCore 
0x344be000 - 0x34500fff ManagedConfiguration armv6 <397723a33c19c3487d304d69580acbfc> /System/Library/PrivateFrameworks/ManagedConfiguration.framework/ManagedConfiguration 
0x34954000 - 0x34a5cfff CoreData armv6 <6e3af4b4648ae695f8d4bc0bf5a9dba5> /System/Library/Frameworks/CoreData.framework/CoreData 
0x34a6e000 - 0x34a72fff CertUI armv6 <57c499baf9d343a78fe1b43f0f3ef997> /System/Library/PrivateFrameworks/CertUI.framework/CertUI 
0x34b52000 - 0x34f1ffff libLAPACK.dylib armv6 <0eb734c91165416224b98c943ff6476b> /System/Library/Frameworks/Accelerate.framework/Frameworks/vecLib.framework/libLAPACK.dylib 
0x34f20000 - 0x35014fff libiconv.2.dylib armv6 <01916d6784f4de8f3746978faae9c5fa> /usr/lib/libiconv.2.dylib 
0x35015000 - 0x35022fff CoreVideo armv6 <7b100fd5fdf98db1cd0f0649e7f6f316> /System/Library/Frameworks/CoreVideo.framework/CoreVideo 
0x35023000 - 0x3507dfff MessageUI armv6 <21bb9d93911f7015b79aef9dc6df55ef> /System/Library/Frameworks/MessageUI.framework/MessageUI 
0x35087000 - 0x35148fff AddressBookUI armv6 <fea72732451610277e22a667d35ad76d> /System/Library/Frameworks/AddressBookUI.framework/AddressBookUI 
0x35151000 - 0x35272fff Foundation armv6 <6bdeb19a1fcb93e2930dadb50416f881> /System/Library/Frameworks/Foundation.framework/Foundation 
0x3529b000 - 0x352a6fff libbz2.1.0.dylib armv6 <6aa8a4ed0906a495d059ace9125f525d> /usr/lib/libbz2.1.0.dylib 
0x352dc000 - 0x35342fff libBLAS.dylib armv6 <11a3677a08175a30df1b3d66d7e0951a> /System/Library/Frameworks/Accelerate.framework/Frameworks/vecLib.framework/libBLAS.dylib 
0x35348000 - 0x353b0fff GMM armv6 <adcdfedd491ac237b385b6c2d7f684e3> /System/Library/PrivateFrameworks/GMM.framework/GMM 
0x35406000 - 0x35406fff vecLib armv6 <8f914b3e8a581d49fb21d2c0ff75be03> /System/Library/Frameworks/Accelerate.framework/Frameworks/vecLib.framework/vecLib 
0x35407000 - 0x3540afff MobileInstallation armv6 <456ed7fe6dd9fcd8e78df425085b1452> /System/Library/PrivateFrameworks/MobileInstallation.framework/MobileInstallation 
0x35541000 - 0x35547fff MBX2D armv6 <fad4955cab36e0179df6f8f27d365b8f> /System/Library/PrivateFrameworks/MBX2D.framework/MBX2D 
0x35758000 - 0x35778fff AppleAccount armv6 <0ef3f6564414f3ef030031ae25b28bbd> /System/Library/PrivateFrameworks/AppleAccount.framework/AppleAccount 
0x35779000 - 0x3577bfff TextInput_de armv6 <e51cb663d64b8ced7dccfdbd3ad04591> /System/Library/TextInput/TextInput_de.bundle/TextInput_de 
0x35815000 - 0x3581afff AssetsLibraryServices armv6 <224b3cf992a01814f91481244e3213eb> /System/Library/PrivateFrameworks/AssetsLibraryServices.framework/AssetsLibraryServices 
0x3581b000 - 0x35877fff libGLImage.dylib armv6 <7c1049f20c4e64591c09d3ac00c7d3ab> /System/Library/Frameworks/OpenGLES.framework/libGLImage.dylib 
0x358bc000 - 0x358c3fff liblockdown.dylib armv6 <f470dea180ddf23886df75eb256d3888> /usr/lib/liblockdown.dylib 
0x358cc000 - 0x358cffff libgcc_s.1.dylib armv6 <bed95ed187350ce27d22ed241ef892ea> /usr/lib/libgcc_s.1.dylib 
0x358d3000 - 0x35d4ffff UIKit armv6 <14ec6c926b8bda71b73136f6e1a6ac1b> /System/Library/Frameworks/UIKit.framework/UIKit 
0x35d5a000 - 0x35e98fff libSystem.B.dylib armv6 <70571c1e697e2ae7f7a9b1a499453bb6> /usr/lib/libSystem.B.dylib 
0x35f7e000 - 0x35fc2fff VideoToolbox armv6 <101dbbcd34cc3231a8be3fd6392556aa> /System/Library/PrivateFrameworks/VideoToolbox.framework/VideoToolbox 
0x35fdb000 - 0x36162fff CoreGraphics armv6 <9a1d72fa9549d83abc1e735ba37a4dc2> /System/Library/Frameworks/CoreGraphics.framework/CoreGraphics 
0x36167000 - 0x36178fff DataAccessExpress armv6 <c112bd2791eb706526db25407ec117d4> /System/Library/PrivateFrameworks/DataAccessExpress.framework/DataAccessExpress 
0x36179000 - 0x36255fff WebKit armv6 <83da207070be989ba81dba3a83d5206a> /System/Library/PrivateFrameworks/WebKit.framework/WebKit 
0x36269000 - 0x36278fff OpenGLES armv6 <37eda5ddcff210dd321157da35a87a5e> /System/Library/Frameworks/OpenGLES.framework/OpenGLES 
0x36279000 - 0x36362fff MapKit armv6 <d28b96a0107a7822fda677ed28901c0c> /System/Library/Frameworks/MapKit.framework/MapKit 
0x363f3000 - 0x363f9fff MobileKeyBag armv6 <2d83bf6a43bab972d77a1a6e0f3b03d2> /System/Library/PrivateFrameworks/MobileKeyBag.framework/MobileKeyBag 
0x363fa000 - 0x36483fff Message armv6 <9ed4944d998f99e69ba81afdda659bee> /System/Library/PrivateFrameworks/Message.framework/Message 
0x36500000 - 0x36508fff ProtocolBuffer armv6 <8ed6e560e85eecfaf625219a8247aea4> /System/Library/PrivateFrameworks/ProtocolBuffer.framework/ProtocolBuffer 
0x365db000 - 0x365f9fff libresolv.9.dylib armv6 <9c94634beea733e754dc115737b6e63c> /usr/lib/libresolv.9.dylib 
0x36746000 - 0x3683cfff libxml2.2.dylib armv6 <9c44d05cc67f1ebabd795903e581724e> /usr/lib/libxml2.2.dylib 
0x3683e000 - 0x36888fff libCGFreetype.A.dylib armv6 <cfc94cfa17958f2f94c9eff208a7dace> /System/Library/Frameworks/CoreGraphics.framework/Resources/libCGFreetype.A.dylib 
0x36889000 - 0x368b4fff MobileSync armv6 <b42cf746d993e6765d432edf47987835> /System/Library/PrivateFrameworks/MobileSync.framework/MobileSync 
0x368b5000 - 0x3692dfff EventKit armv6 <c1fb82d645d3bf1f2e0558cc884712e9> /System/Library/Frameworks/EventKit.framework/EventKit 
0x3694c000 - 0x3694ffff libAccessibility.dylib armv6 <74e0f77cc276a9412be268c795fdcbca> /usr/lib/libAccessibility.dylib 
0x36955000 - 0x36a1ffff Celestial armv6 <11172a6ee53bdf067548cd4496bc5fe0> /System/Library/PrivateFrameworks/Celestial.framework/Celestial 
0x36a20000 - 0x36a2cfff WebBookmarks armv6 <5d1eb10d851d0362e304d9d95f016df1> /System/Library/PrivateFrameworks/WebBookmarks.framework/WebBookmarks 
0x36a2d000 - 0x36a30fff CrashReporterSupport armv6 <00bc60f690e6328b64e7a7b718edf45a> /System/Library/PrivateFrameworks/CrashReporterSupport.framework/CrashReporterSupport 
0x36a31000 - 0x36a74fff CoreTelephony armv6 <cabbce0fa7630065dc7e7d3ca3bc616c> /System/Library/Frameworks/CoreTelephony.framework/CoreTelephony 
0x36c1c000 - 0x36c26fff AggregateDictionary armv6 <f7429444c955e4f13c6761d20032ab52> /System/Library/PrivateFrameworks/AggregateDictionary.framework/AggregateDictionary 
0x36c2b000 - 0x36de1fff AudioToolbox armv6 <bb65e8ed531fe5923eb8ac00a7c0d87d> /System/Library/Frameworks/AudioToolbox.framework/AudioToolbox 
0x36de2000 - 0x36e16fff AppSupport armv6 <783e14db9585fd063c0c2a755cd121b6> /System/Library/PrivateFrameworks/AppSupport.framework/AppSupport 
0x36e17000 - 0x36e2dfff PersistentConnection armv6 <006723906b8ac250c1681a1821fbe94d> /System/Library/PrivateFrameworks/PersistentConnection.framework/PersistentConnection 
0x36e2e000 - 0x37140fff GeoServices armv6 <570238d025d41838cc888a0b3f28f4b2> /System/Library/PrivateFrameworks/GeoServices.framework/GeoServices 
0x37141000 - 0x37184fff SystemConfiguration armv6 <207f362e707871e74a292cfd1ea7893d> /System/Library/Frameworks/SystemConfiguration.framework/SystemConfiguration 
0x372aa000 - 0x37477fff MediaToolbox armv6 <21ceabd0e5de17ad4e883c85fcd34d51> /System/Library/PrivateFrameworks/MediaToolbox.framework/MediaToolbox 
0x37478000 - 0x3747dfff IOSurface armv6 <ffd66ca04dfe7d382d6961f0df3839ff> /System/Library/PrivateFrameworks/IOSurface.framework/IOSurface 
0x3748d000 - 0x374f8fff libstdc++.6.dylib armv6 <eccd1d7183e73587b2c0aa5755a19c39> /usr/lib/libstdc++.6.dylib 
0x374f9000 - 0x375e4fff CoreFoundation armv6 <ab0eac0ddd5b4ae1bf8541116e3c0bd1> /System/Library/Frameworks/CoreFoundation.framework/CoreFoundation 
0x3760a000 - 0x3760bfff DataMigration armv6 <d2de7c0db77278484236669c2cdccabb> /System/Library/PrivateFrameworks/DataMigration.framework/DataMigration 
0x37731000 - 0x37736fff libGFXShared.dylib armv6 <bd1c480607cc286288db1ca1aec64180> /System/Library/Frameworks/OpenGLES.framework/libGFXShared.dylib 
0x377f6000 - 0x37817fff libRIP.A.dylib armv6 <22c6da37f3adf325f99c3a0494e04c02> /System/Library/Frameworks/CoreGraphics.framework/Resources/libRIP.A.dylib 
0x37992000 - 0x37999fff libMobileGestalt.dylib armv6 <de9b417e7278742e90b30b1ad45f31fa> /usr/lib/libMobileGestalt.dylib 

Répondre

0

Dans certains cas très rares de l'App se bloque avec une EXC_BAD_ACCESS en ligne mergeChangesFromContextDidSaveNotification: disant que le saveNotification a un résumé invalide .

EXC_BAD_ACCESS (même le try-catch bloc ne fonctionne pas) est un accident dur, pas une exception, ce qui explique pourquoi l'try-catch n'attraper. Pouvez-vous poster le backtrace de l'accident et le message récapitulatif invalide?

Dans l'ensemble, cela ressemble à un problème de synchronisation de threads. Il semble que vous ayez un modèle de concurrence relativement complexe et, plus probablement qu'autrement, il existe un bug de synchronisation quelque part.

+0

va certainement faire quand il apparaît à nouveau. Y at-il un moyen facile d'enregistrer l'état complet de l'accident, y compris les objets pertinents et les valeurs du débogueur? –

+1

Le problème commun de simultanéité ici est que vous appelez mergeChangesFromContextDidSaveNotification: à partir d'un thread différent de celui sur lequel vous avez créé le contexte cible. par exemple. vous créez un contexte sur le thread principal, mais appelez mergeChanges à partir d'un thread différent. Assurez-vous que tous vos appels à mergeChanges se trouvent sur le thread propriétaire du contexte, vous pouvez utiliser performSelector: OnThread: pour cela. – ImHuntingWabbits

+0

Je suis sûr que c'est sur le même thread car j'appelle la sauvegarde du même contexte et puis fusionne les changements d'un autre contexte. BTW J'ai inclus un journal de panne. –

0

Si vous utilisez plusieurs ManagedObjectContext à travers des threads, vous devez verrouiller le contexte avant toute opération de lecture/écriture sur ManagedObjects à partir de ce contexte.

Ceci est particulièrement important lors de l'implémentation de mergeContextFromDidSaveNotification car, dans ce cas, le contexte est utilisé simultanément par 2 threads. Vous devez ensuite verrouiller le contexte avant la fusion dans le thread notifié (généralement le thread principal) et avant toute modification du thread d'arrière-plan.

+0

ce n'est pas tout à fait correct MOC n'est pas thread thread mais le coordonnateur de magasin est. Et j'utilise le didSaveNotification pour fusionner les trois contextes différents (comme Apple l'a fait dans l'exemple des livres) –

+0

Je ne sais pas si cette réponse est correcte. A partir de la documentation CoreData: "Il n'est généralement pas nécessaire d'utiliser des verrous avec des objets gérés ou des contextes d'objets gérés.Si vous utilisez un seul coordinateur de stockage persistant partagé par plusieurs contextes et que vous souhaitez effectuer des opérations sur le coordinateur de stockage persistant, le coordinateur du magasin persistant. " – bentford

Questions connexes