xcode 11 新建項(xiàng)目及配置
在xcode11中新建項(xiàng)目默認(rèn)使用ios13 SDK創(chuàng)建,會直接將APP生命周期從APPdelegate轉(zhuǎn)交給SceneDelegate
項(xiàng)目文件結(jié)構(gòu)如下
├── yourProject? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? // 項(xiàng)目文件│? ├── yourProject? ? ? ? ? ? ? ? ? ? ? ? ? ? // 源碼文件夾│? │? ├── AppDelegate.swift? ? ? ? ? │? │? ├── SceneDelegate.swift? ? ? ? ? ? │? │? ├── ViewController.swift? ? ? ? ? ? ? ? ? ? │? │? ├── Main.storyboard? ? ? ? ? ? ? ? │? │? ├── Assets.xcassets? ? ? ? ? ? ? ? ? ? │? │? │? └── shop.png? ? ? ? ? ? ? ? ? │? │? ├── LaunchScreen.storyboard? ? ? ? ? ? ? ? ? ? ? ? │? │? ├── Info.plist
如果我們修改development target 低于13.0 編譯項(xiàng)目就會報錯,是由于新api(sceneDelegate)導(dǎo)致的猜拾,為此我們需要將生命周期還原為APPdelegate來管理,
打開info.plis刪除Application Scene Manifest這一項(xiàng)
刪除 SceneDelegate.swift 文件
將APPdelegate進(jìn)行如下修改