-[MyClassName persistentStoreCoordinator].cold.1 Crash

Hi Team,


I am struggling to find the reason of crash of my iOS app. The crash is not reprodicible in any of iOS devices.

Crash Log is:


Crashed: com.apple.main-thread

SIGABRT ABORT 0x000000019d8fbec4


Crashed: com.apple.main-thread

0 libsystem_kernel.dylib 0x19d8fbec4 __pthread_kill + 8

1 libsystem_pthread.dylib 0x19d8171d8 pthread_kill$VARIANT$mp + 136

2 libsystem_c.dylib 0x19d76b844 abort + 100

3 WDIV 0x102d90cf0 -[DataManager persistentStoreCoordinator].cold.1 + 4307684592

4 WDIV 0x1029a9e94 -[DataManager mainObjectContext] + 78 (DataManager.m:78)

5 WDIV 0x1029a9f08 -[DataManager mainObjectContext] + 91 (DataManager.m:91)

6 WDIV 0x1029ff1d8 -[DataDownloadManager getDataForEntity:] + 1321 (DataDownloadManager.m:1321)

7 WDIV 0x102a00300 -[DataDownloadManager getMetNotificationId] + 1517 (DataDownloadManager.m:1517)

8 WDIV 0x102a00b1c -[DataDownloadManager deleteWeatherData] + 1602 (DataDownloadManager.m:1602)

9 WDIV 0x102a00a08 -[DataDownloadManager deleteAlertsData] + 1588 (DataDownloadManager.m:1588)

10 WDIV 0x102a8cae8 -[AppDelegate application:didFinishLaunchingWithOptions:] + 185 (AppDelegate.m:185)

11 UIKitCore 0x1a1b80ee4 -[UIApplication _handleDelegateCallbacksWithOptions:isSuspended:restoreState:] + 340

12 UIKitCore 0x1a1b82ca0 -[UIApplication _callInitializationDelegatesWithActions:forCanvas:payload:fromOriginatingProcess:] + 5076

13 UIKitCore 0x1a1b8842c -[UIApplication _runWithMainScene:transitionContext:completion:] + 1248

14 UIKitCore 0x1a1355208 -[_UISceneLifecycleMultiplexer completeApplicationLaunchWithFBSScene:transitionContext:] + 148

15 UIKitCore 0x1a17eb698 _UIScenePerformActionsWithLifecycleActionMask + 100

16 UIKitCore 0x1a1355cf0 __101-[_UISceneLifecycleMultiplexer _evalTransitionToSettings:fromSettings:forceExit:withTransitionStore:]_block_invoke + 196

17 UIKitCore 0x1a13557fc -[_UISceneLifecycleMultiplexer _performBlock:withApplicationOfDeactivationReasons:fromReasons:] + 476

18 UIKitCore 0x1a1355b1c -[_UISceneLifecycleMultiplexer _evalTransitionToSettings:fromSettings:forceExit:withTransitionStore:] + 736

19 UIKitCore 0x1a13553d8 -[_UISceneLifecycleMultiplexer uiScene:transitionedFromState:withTransitionContext:] + 336

20 UIKitCore 0x1a13598c4 __186-[_UIWindowSceneFBSSceneTransitionContextDrivenLifecycleSettingsDiffAction _performActionsForUIScene:withUpdatedFBSScene:settingsDiff:fromSettings:transitionContext:lifecycleActionType:]_block_invoke_2 + 188

21 UIKitCore 0x1a171cf08 +[BSAnimationSettings(UIKit) tryAnimatingWithSettings:actions:completion:] + 824

22 UIKitCore 0x1a1804c84 _UISceneSettingsDiffActionPerformChangesWithTransitionContext + 244

23 UIKitCore 0x1a13595fc __186-[_UIWindowSceneFBSSceneTransitionContextDrivenLifecycleSettingsDiffAction _performActionsForUIScene:withUpdatedFBSScene:settingsDiff:fromSettings:transitionContext:lifecycleActionType:]_block_invoke + 136

24 UIKitCore 0x1a1804b80 _UISceneSettingsDiffActionPerformActionsWithDelayForTransitionContext + 100

25 UIKitCore 0x1a1359468 -[_UIWindowSceneFBSSceneTransitionContextDrivenLifecycleSettingsDiffAction _performActionsForUIScene:withUpdatedFBSScene:settingsDiff:fromSettings:transitionContext:lifecycleActionType:] + 376

26 UIKitCore 0x1a11cb2c0 __64-[UIScene scene:didUpdateWithDiff:transitionContext:completion:]_block_invoke + 636

27 UIKitCore 0x1a11c9e28 -[UIScene _emitSceneSettingsUpdateResponseForCompletion:afterSceneUpdateWork:] + 248

28 UIKitCore 0x1a11caff8 -[UIScene scene:didUpdateWithDiff:transitionContext:completion:] + 220

29 UIKitCore 0x1a1b867e4 -[UIApplication workspace:didCreateScene:withTransitionContext:completion:] + 548

30 UIKitCore 0x1a173d900 -[UIApplicationSceneClientAgent scene:didInitializeWithEvent:completion:] + 360

31 FrontBoardServices 0x1a2c377a0 -[FBSSceneImpl _callOutQueue_agent_didCreateWithTransitionContext:completion:] + 436

32 FrontBoardServices 0x1a2c5c838 __86-[FBSWorkspaceScenesClient sceneID:createWithParameters:transitionContext:completion:]_block_invoke.154 + 100

33 FrontBoardServices 0x1a2c41f04 -[FBSWorkspace _calloutQueue_executeCalloutFromSource:withBlock:] + 232

34 FrontBoardServices 0x1a2c5c4f4 __86-[FBSWorkspaceScenesClient sceneID:createWithParameters:transitionContext:completion:]_block_invoke + 312

35 libdispatch.dylib 0x19d7d1184 _dispatch_client_callout + 16

36 libdispatch.dylib 0x19d779fd8 _dispatch_block_invoke_direct$VARIANT$mp + 224

37 FrontBoardServices 0x1a2c81418 __FBSSERIALQUEUE_IS_CALLING_OUT_TO_A_BLOCK__ + 40

38 FrontBoardServices 0x1a2c810e4 -[FBSSerialQueue _queue_performNextIfPossible] + 404

39 FrontBoardServices 0x1a2c8160c -[FBSSerialQueue _performNextFromRunLoopSource] + 28

40 CoreFoundation 0x19da82a00 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 24

41 CoreFoundation 0x19da82958 __CFRunLoopDoSource0 + 80

42 CoreFoundation 0x19da820f0 __CFRunLoopDoSources0 + 180

43 CoreFoundation 0x19da7d23c __CFRunLoopRun + 1080

44 CoreFoundation 0x19da7cadc CFRunLoopRunSpecific + 464

45 GraphicsServices 0x1a7a1d328 GSEventRunModal + 104

46 UIKitCore 0x1a1b8a63c UIApplicationMain + 1936

47 WDIV 0x102a0d7c4 main + 15 (main.m:15)

48 libdyld.dylib 0x19d906360 start + 4



DataManager -> Line number 78 is start of following method:


78 - (NSManagedObjectContext *)mainObjectContext

79 {

80 if (_mainObjectContext)

81 return _mainObjectContext;

82

83 if (![NSThread isMainThread]) {

84 [self performSelectorOnMainThread:@selector(mainObjectContext)

85 withObject:nil

86 waitUntilDone:YES];

87 return _mainObjectContext;

88 }

89

90 _mainObjectContext = [[NSManagedObjectContext alloc] initWithConcurrencyType:NSPrivateQueueConcurrencyType];

91 [_mainObjectContext setPersistentStoreCoordinator:self.persistentStoreCoordinator];

92

93 return _mainObjectContext;

94 }



DataManager -> Ther is one more method which can be useful for tracing crash:

- (NSPersistentStoreCoordinator *)persistentStoreCoordinator

{

if (_persistentStoreCoordinator)

return _persistentStoreCoordinator;


NSString *storePath = [[self sharedDocumentsPath] stringByAppendingPathComponent:kDataManagerSQLiteName];

NSURL *storeURL = [NSURL fileURLWithPath:storePath];


NSDictionary *option = @{NSMigratePersistentStoresAutomaticallyOption: @YES,

NSInferMappingModelAutomaticallyOption: @YES};


NSError *error = nil;

_persistentStoreCoordinator = [[NSPersistentStoreCoordinator alloc] initWithManagedObjectModel:self.objectModel];

if (![_persistentStoreCoordinator addPersistentStoreWithType:NSSQLiteStoreType

configuration:nil

URL:storeURL

options:option

error:&error]) {

[[NSFileManager defaultManager] removeItemAtURL:storeURL error:nil];

if (![_persistentStoreCoordinator addPersistentStoreWithType:NSSQLiteStoreType

configuration:nil

URL:storeURL

options:option

error:&error]) {

NSLog(@"Fatal error while creating persistent store: %@", error);

abort();

}

}


return _persistentStoreCoordinator;

}

Are you using a third-party crash reporter here? If so, my advice is that you remove it and see if that improves the quality of the crash reports you receive.

Share and Enjoy

Quinn “The Eskimo!”
Apple Developer Relations, Developer Technical Support, Core OS/Hardware

let myEmail = "eskimo" + "1" + "@apple.com"
-[MyClassName persistentStoreCoordinator].cold.1 Crash
 
 
Q