简体   繁体   English

移至Xcode 7 / Swift 2.0会使应用卡在启动屏幕上

[英]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.xx it ran as expected. 最近,由于我的应用程序无法在iOS 9(任何设备)上编译,因此我移至Xcode 7和Swift 2.0,但是在iOS 8.xx上,它按预期运行。

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 . 我环顾了Xcode并试图找到一些原因,但是我能发现的是,当Xcode停留在启动屏幕上时,在Xcode调试器中按下“暂停”将告诉我该代码在objc_msgSend The CPU usage also hits 100% (use to only be ~10-20% on 8.xx). CPU使用率也达到100%(在8.xx上仅使用〜10-20%)。

CPU使用率

应用卡住的线程

objc_msg发送代码

Nothing else out of the ordinary. 没有什么不寻常的。 Everything worked fine on Xcode 6.4. 在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. 我将所有代码迁移到了Swift 2.0-我没有任何编译错误ld: warning: directory not found for option '-F/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator9.0.sdk/Developer/Library/Frameworks'除外ld: warning: directory not found for option '-F/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator9.0.sdk/Developer/Library/Frameworks'但根据我的搜索,这并不是我遇到的最大问题。 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. 编辑 :将情节提要更改为从常规ViewController和标签开始,并且运行良好。 Seems like it has something to do with me using a UISplitViewController . 似乎它与我使用UISplitViewController Here's some code from AppDelegate.swift: 这是来自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
}

Check you Storyboard. 检查您的情节提要。 Seems your screen contains TextField(s) with default text in it. 似乎您的屏幕上包含带有默认文本的TextField。 Simply clear text in this TextField and try again. 只需清除此TextField中的文本,然后重试。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM