1

My app got rejected for crash on launch and after symbolizing the crash log i have this:

Incident Identifier: --
CrashReporter Key:   --
Hardware Model:      xxx
Process:             BUDGT [1029]
Path:                /private/var/mobile/Containers/Bundle/Application/F5D98A63-AF73-4A76-A80C-EA57B4E41082/BUDGT.app/BUDGT
Identifier:          --.BUDGT
Version:             1 (4)
Code Type:           ARM-64 (Native)
Parent Process:      launchd [1]

Date/Time:           2015-05-08 18:09:23.379 -0700
Launch Time:         2015-05-08 18:09:23.142 -0700
OS Version:          iOS 8.3 (12F70)
Report Version:      105

Exception Type:  EXC_CRASH (SIGABRT)
Exception Codes: 0x0000000000000000, 0x0000000000000000
Triggered by Thread:  0

Thread 0 name:  Dispatch queue: com.apple.main-thread
Thread 0 Crashed:
0   libsystem_kernel.dylib          0x0000000197acb270 __pthread_kill + 8
1   libsystem_pthread.dylib         0x0000000197b6916c pthread_kill + 108
2   libsystem_c.dylib               0x0000000197a42b14 abort + 108
3   BUDGT                           0x000000010009ee5c -[AppDelegate persistentStoreCoordinator] (AppDelegate.m:222)
4   BUDGT                           0x000000010009e96c -[AppDelegate managedObjectContext] (AppDelegate.m:153)
5   BUDGT                           0x00000001000a0abc -[Factory setupDataHandler] (Factory.m:54)
6   BUDGT                           0x00000001000a0830 -[Factory init] (Factory.m:30)
7   BUDGT                           0x00000001000a07c4 __25+[Factory defaultFactory]_block_invoke (Factory.m:22)
8   libdispatch.dylib               0x0000000197985950 _dispatch_client_callout + 12
9   libdispatch.dylib               0x0000000197986828 dispatch_once_f + 92
10  BUDGT                           0x00000001000a0794 +[Factory defaultFactory] (once.h:68)
11  BUDGT                           0x000000010009dab8 -[AppDelegate application:didFinishLaunchingWithOptions:] (AppDelegate.m:17)
12  UIKit                           0x000000018a5c318c -[UIApplication _handleDelegateCallbacksWithOptions:isSuspended:restoreState:] + 400
13  UIKit                           0x000000018a7da850 -[UIApplication _callInitializationDelegatesForMainScene:transitionContext:] + 2372
14  UIKit                           0x000000018a7dd204 -[UIApplication _runWithMainScene:transitionContext:completion:] + 1500
15  UIKit                           0x000000018a7db774 -[UIApplication workspaceDidEndTransaction:] + 180
16  FrontBoardServices              0x000000018e3193c4 __31-[FBSSerialQueue performAsync:]_block_invoke_2 + 28
17  CoreFoundation                  0x0000000185ac8278 __CFRUNLOOP_IS_CALLING_OUT_TO_A_BLOCK__ + 16
18  CoreFoundation                  0x0000000185ac7380 __CFRunLoopDoBlocks + 308
19  CoreFoundation                  0x0000000185ac59a4 __CFRunLoopRun + 1752
20  CoreFoundation                  0x00000001859f12d0 CFRunLoopRunSpecific + 392
21  UIKit                           0x000000018a5bc438 -[UIApplication _run] + 548
22  UIKit                           0x000000018a5b6fa8 UIApplicationMain + 1484
23  BUDGT                           0x000000010009da38 main (main.m:16)
24  libdyld.dylib                   0x00000001979b2a04 start + 0

this means it must have failed here at abort() in my AppDelegate

- (NSPersistentStoreCoordinator *)persistentStoreCoordinator
{

    if (persistentStoreCoordinator != nil)
    {
        return persistentStoreCoordinator;
    }
    NSError *error = nil;
    persistentStoreCoordinator = [[NSPersistentStoreCoordinator alloc] initWithManagedObjectModel:[self managedObjectModel]];
    NSURL *storeURL = [[self applicationDocumentsDirectory] URLByAppendingPathComponent:@"database.sqlite"];
    NSPersistentStoreCoordinator *psc = persistentStoreCoordinator;
    NSDictionary *options = [NSDictionary dictionaryWithObjectsAndKeys:
                             [NSNumber numberWithBool:YES], NSMigratePersistentStoresAutomaticallyOption,
                             [NSNumber numberWithBool:YES], NSInferMappingModelAutomaticallyOption, nil];

    NSPersistentStore *store = [psc addPersistentStoreWithType:NSSQLiteStoreType
                                                 configuration:nil URL:storeURL
                                                       options:options error:&error];
    if (!store) {
        NSLog(@"Unresolved Error");
        abort();   // This is line 222 of AppDelegate
    }


    return persistentStoreCoordinator;
}

getting the directory like this:

- (NSURL *)applicationDocumentsDirectory {
    return [[[NSFileManager defaultManager] URLsForDirectory:NSDocumentDirectory inDomains:NSUserDomainMask] lastObject];
}

and the mom like that:

- (NSManagedObjectModel *)managedObjectModel {
    if (managedObjectModel != nil)
    {
        return managedObjectModel;
    }
    managedObjectModel = [NSManagedObjectModel mergedModelFromBundles:nil] ;

    return managedObjectModel;
}

Apples rejection message:

We could not review your app as it crashes on startup.

i personally cannot reproduce the problem.

both an update to my devices and simulators - as well as clean builds run just fine without any issues.

the things i changed in this application was:

  • support for app groups (coredata container is not in the app group container)
  • changed to cocoapods for linking
  • added WatchKit App
  • added Today Extension
  • migrated all views to use AutoLayout (Masonry)

however I am not accessing core data through the app group container, it still only sits on the phone (and should stay there) i am using the app group for something different (pass simple messages through it).

any ideas what might be causing this to crash the app on startup with apples review team?

deployment target is iOS 8.2 (for all the app & extensions)

update

i just manually installed the submitted archive (the original build for the app store submission) to a cleaned device. everything works perfectly. no issues, no crashes.

what else can I Check?

Sebastian Flückiger
  • 5,525
  • 8
  • 33
  • 69
  • can you replace your "unresolved error" log with the NSError you have setup there? Also are you pre-populating your datastore? – Siriss May 09 '15 at 04:18
  • Sadly i cannot, the crash log comes from apple, i cannot reproduce the error - it never crashes on my devices :/ – Sebastian Flückiger May 09 '15 at 05:03
  • Did you do any updates in the data model? New entities, attributes, etc? I see lightweight migration options, but did you create new version model for your update? Or maybe your model changes (if such exist) are not compatible with lightweight migration. – Krivoblotsky May 09 '15 at 06:18
  • @Krivoblotsky no model changes in this version :) And apple would do a clean install for review, right? So even if there were changes (there arent) this should not play a ro.e – Sebastian Flückiger May 09 '15 at 06:20
  • 1
    @SebastianFlückiger I saw this `abort() causes the application to generate a crash log and terminate. You should not use this function in a shipping application, although it may be useful during development. If it is not possible to recover from the error, display an alert panel that instructs the user to quit the application by pressing the Home button` commented in a line of code on this post - http://stackoverflow.com/questions/9650317/strange-app-crash-on-iphone-not-rejected-by-apple – Jesse Onolemen May 09 '15 at 11:08
  • I would not assume Apple would only do a clean install, that would be a bad test. A very common user install would be an update to the previously installed version and I would hope Apple would test that. I would suggest resetting the device to clear all areas of persistence such as the keychain and shared areas. Then installing the current version from the app store and going through initial setup. Then updating to the new version and running. – zaph May 09 '15 at 11:10
  • @Jesster2k10 thank you, i will add error handling with the next submission. However this does not help me with the actual problem at hand, that for some reason in Apples Test environment the persistenstorecoordinator is null when it shouldn't be. – Sebastian Flückiger May 09 '15 at 11:11
  • @zaph i will try this approach to reproduce the error, thank you. – Sebastian Flückiger May 09 '15 at 11:12
  • @SebastianFlückiger is the abort(); function ran to quit your application? – Jesse Onolemen May 09 '15 at 11:13
  • @zaph, just performed what you proposed. application installed through appstore (old version, clean install). added some data so something actually exists. installed update through xcode. everything worked perfectly. no crash, no errors, no nothing :/ – Sebastian Flückiger May 09 '15 at 11:17
  • 1
    As a follow up to @Jesster2k10 you have an error parameter on thre `addPersistentStoreWithType` method call that you do not use. If you had used the error mesage in a dialog to the user log message and not just aborted you would have a good idea of the error. – zaph May 09 '15 at 11:17
  • @zaph added the error log before attempting your suggestion about the clean install. since everything worked fine, there was no log generated .. I am quite sure that if I were able to reproduce the problem that I'd be able to fix it. But I am running out of ideas on how to reproduce it.. – Sebastian Flückiger May 09 '15 at 11:19
  • 1
    @Jesster2k10 yes it's a default abort message for ios apps. but again - the abort statement is not the real problem, the problem is that it is reached (by now I replaced it with error handling). – Sebastian Flückiger May 09 '15 at 11:20
  • @SebastianFlückiger How did you do a clean install? DId you reset the dev ice? Settings, Reset, Erase All Content amd Settings? – zaph May 09 '15 at 11:20
  • 1
    @SebastianFlückiger Okay I have a better understanding now. – Jesse Onolemen May 09 '15 at 11:21
  • @zaph i am currently on the road only with my laptop & my actual phone. I only deleted the app and its settings & data, not a complete phone wipe (cannot do that to my main phone), that'd have to wait till next week when I have access to my test devices again. – Sebastian Flückiger May 09 '15 at 11:23
  • 1
    @SebastianFlückiger There are things that a deletion of the app does not remove including keychain entries and shared areas such are created by app groups. – zaph May 09 '15 at 11:25
  • @zaph ok I will repaet when I am back home. As far as app groups goes, i introduced them with this specific update. This means they were not there beforehand (even with apple they could not have been there). However i do suspect the app groups to be the issue as it is the only thing that has to do with containers that i changed. Coredata however is not within the shared container (and should not be in this case). Could it be that for some reason apples device was checking in the shared container instead of locally? – Sebastian Flückiger May 09 '15 at 11:31
  • @zaph thank you for the effort! see my answer. there was nothing wrong with the App. It was a mistake by the Review team. – Sebastian Flückiger May 09 '15 at 17:16

1 Answers1

2

Well... the answer is simple. There was nothing wrong with my Application.

"Thank you for your response. Upon further review, we have found the application no longer crashes on launch."

Sebastian Flückiger
  • 5,525
  • 8
  • 33
  • 69