模拟器未显示任何输出

时间:2018-11-12 09:42:20

标签: ios iphone ios-simulator xcode9.4

当我整合可可粉时,模拟器出现错误。尽管我的模拟器在不集成cocoapods的情况下仍能正常工作。.当我在模拟器上运行代码时,它没有显示任何输出,但这是模拟器的Screenshot和断点result < / p>

AppDelegate.swift

 func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool
    {
        GMSServices.provideAPIKey("gasdgsdsjbnksdfkdf")
        GMSPlacesClient.provideAPIKey("shgdsgfskdakdjadj")

        self.window = UIWindow(frame: UIScreen.main.bounds)
        if let window = self.window {
            window.backgroundColor = UIColor.white

            let nav = UINavigationController()
            let mainView = ViewController()
            nav.viewControllers = [mainView]
            window.rootViewController = nav
            window.makeKeyAndVisible()
       }
        return true
    }

1 个答案:

答案 0 :(得分:0)

let mainView = ViewController()

这不是从情节提要中初始化视图控制器的正确方法。

使用

UIStoryboard(name: "Main", bundle: nil).instantiateViewController(withIdentifier: "<"Your storyboard id">") as? ViewController