uti0mnia
uti0mnia

Reputation: 394

Moving to Xcode 7/Swift 2.0 causes app to get stuck on launch screen

Recently I moved to Xcode 7 and Swift 2.0 since my app wouldn't compile on iOS 9 (any device), however on iOS 8.x.x it ran as expected.

I have looked around Xcode and tried to find some reasons, but all I could find was that when it gets stuck on the launch screen, pressing pause in the Xcode debugger tells me that the code is on objc_msgSend. The CPU usage also hits 100% (use to only be ~10-20% on 8.x.x).

CPU usage

Thread where app gets stuck on

objc_msgSend code

Nothing else out of the ordinary. Everything worked fine on Xcode 6.4. I migrated all the code to swift 2.0 - I do not have any compiling errors - except ld: warning: directory not found for option '-F/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator9.0.sdk/Developer/Library/Frameworks' but from what I've googled this isn't the biggest of my problems. I have no idea what to do anymore.

If you require parts of my code or whatever just let me know and I'll post it :)

Thanks!

Edit: Changed the storyboard to start at a regular ViewController and a label and it runs fine. Seems like it has something to do with me using a UISplitViewController. Here's some code from AppDelegate.swift:

func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool {
    // Override point for customization after application launch.

    //get split VC
    let splitViewController = self.window!.rootViewController as! UISplitViewController
    splitViewController.delegate = self

    //Configure the master part
    let masterNavigationController = splitViewController.viewControllers[0] as! UINavigationController
    masterNavigationController.navigationBar.tintColor = UIColor(red: 236/255, green: 240/255, blue: 241/255, alpha: 1)
    masterNavigationController.navigationBar.barTintColor = UIColor(red: 40/255, green: 162/255, blue: 47/255, alpha: 1)
    let controller = masterNavigationController.topViewController as! NoteListViewController
    controller.context = self.managedObjectContext!


    //configure the detail
    let detailNavController = splitViewController.viewControllers.last as! UINavigationController
    let detailViewController = detailNavController.topViewController as! NoteDetailViewController
    detailViewController.navigationItem.leftItemsSupplementBackButton = true
    detailViewController.navigationItem.leftBarButtonItem = splitViewController.displayModeButtonItem()
    detailNavController.navigationBar.barTintColor = UIColor(red: 40/255, green: 162/255, blue: 47/255, alpha: 1)



    //configure the data for detail
    controller.delegate = detailViewController
    let firstNote = fetchFirstResult(inContext: controller.context)
    if firstNote != nil{
        detailViewController.note = firstNote
        detailViewController.context = self.managedObjectContext!
        controller.tableIsEmpty = false
        controller.appHasLoadedOnce = false
    }




    return true
}

Upvotes: 2

Views: 831

Answers (1)

Petr Lazarev
Petr Lazarev

Reputation: 3182

Check you Storyboard. Seems your screen contains TextField(s) with default text in it. Simply clear text in this TextField and try again.

Upvotes: 3

Related Questions