Search code examples
objective-cios13xcode11

Crash Xcode 11, iOS13 setting root view controller


Since a few days I've been experiencing a very strange crash when debugging our app within Xcode 11.

Situation

We have an app built for iOS 11 and higher. But since Xcode 11 the app is crashing on setting the root view controller. But when I open the app after it crashed, the app does work so it seems it has something to do with setup a debug session.

The device where I try to build on is an iPhone Xs, with iOS 13.1.2. I also tried another device with 13.1 but having the same issue there.

However, when I attach a device that is running on 12.x.x it's working.

Strangely, yesterday I was able to run on a simulator. But since today the same crash occures on a device (iPhone Xs).

Also maybe important to mention: colleagues of me that work with the same project, do not have the same issues. (!!)

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {

// Show app loading view controller
self.window = [[RMWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
self.window.rootViewController = [[AppLoadingViewController alloc] init]; // Thread 1: EXC_BAD_INSTRUCTION (code=EXC_I386_INVOP, subcode=0x0)
[self.window makeKeyAndVisible];

I tried the following:

  • Replaced AppDelegate.h/m by AppDelegate.swift.
  • Update all project settings to latest settings from Xcode 11.
  • Tried a plain UIViewController() instead of AppLoadingViewController().
  • Cleaned Derived Folder (hardcore style)
  • Clean all Xcode cache
  • Reinstall Xcode
  • Restarted Mac + iPhone
  • Removed the iOS DeviceSupport folder from Xcode preferences, re-connected device via 'Devices and Simulators'.
  • Created a new project and run on iPhone, DOES work.

This is an app that contains both Objective-C and Swift code, we have it already for years. But it's the first time that something like this is happening.

Is there anyone who has an idea of what this could be?


Solution

  • After spending days on this I have clean installed Mac OS Catalina. This did fix it. I still don't know what the actual problem was, but to potentially save a lot of time for others I suggest doing the same.

    If somebody found the solution I would still like to know.