Search code examples
swiftrealmtestflightcrashlyticstwitter-fabric

iOS app freeze when launched through testflight with Realm and Crashlytics


Upon submitting an app for Beta review it gets rejected for launching to a blank screen on iPad.

I've tested on multiple iphones and simulators, but could not reproduce anything. The only way to reproduce this at all has been to press the "Open"-button within the Testflight app itself. Pressing the icon on the homescreen always works (even on an iPad that crashes from testflight).

While connected via USB I check the logs in Xcode Devices:

... <Warning>: [Crashlytics] Version 3.7.0 (102)
... <Warning>: [Crashlytics:Crash] Warning: NSUncaughtExceptionHandler is '_ZZ34RLMInstallUncaughtExceptionHandlerEN3$_08__invokeEP11NSException' in '/private/var/mobile/Containers/Bundle/Application/DF8A0CBE-99D1-4466-ACAE-F1BB7D8DA4BC/Feeder.app/Frameworks/Realm.framework/Realm'

At the final line it just stops. No more debug messages. The launchscreen.xib fades away and the screen goes to white. It doesn't crash or anything.

I've tried:

  1. Different versions of Fabric and Crashlytics
  2. Removing Fabric and Crashlytics
  3. Completely moving initialization of Realm around
  4. Rewriting how the app starts
  5. Different versions of Realm (0.96 and 0.98.4)

Solution

  • I found the issue for this, and it was not Realm-related or Crashlytics related. I had this code in my AppDelegate:

    @UIApplicationMain
    class AppDelegate: UIResponder, UIApplicationDelegate {
    
        var window: UIWindow?
    
    
        func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool {
            // This breaks it
            for window in application.windows {
                window.backgroundColor = UIColor.whiteColor()
            }
    
            // this works...
            // window?.backgroundColor = UIColor.whiteColor()
    
            return true
        }
    
    }