XCode11新增SceneDelegate

新情況

更新到XCode11之后,老項(xiàng)目沒關(guān)系,但是新建項(xiàng)目,和以前完全不一樣了。增加了SceneDelegate,據(jù)說是為了iPad的多進(jìn)程準(zhǔn)備的。

image.png

AppDelegate.m中增加了關(guān)于SceneDelegate的函數(shù)。

#pragma mark - UISceneSession lifecycle


- (UISceneConfiguration *)application:(UIApplication *)application configurationForConnectingSceneSession:(UISceneSession *)connectingSceneSession options:(UISceneConnectionOptions *)options {
    // Called when a new scene session is being created.
    // Use this method to select a configuration to create the new scene with.
    return [[UISceneConfiguration alloc] initWithName:@"Default Configuration" sessionRole:connectingSceneSession.role];
}


- (void)application:(UIApplication *)application didDiscardSceneSessions:(NSSet<UISceneSession *> *)sceneSessions {
    // Called when the user discards a scene session.
    // If any sessions were discarded while the application was not running, this will be called shortly after application:didFinishLaunchingWithOptions.
    // Use this method to release any resources that were specific to the discarded scenes, as they will not return.
}

去掉不需要的SceneDelegate

如果沒有多進(jìn)程需求,那么還是去掉這個(gè)多余的SceneDelegate比較好。

  • 直接刪除SceneDelegate文件,包括.h,.m

  • 刪除info.plist中的Application Scene Manifest選項(xiàng)

  • 刪除AppDelegate.m中關(guān)于SceneDelegate的函數(shù)。

  • AppDelegate.h中添加window屬性

@property (strong, nonatomic) UIWindow *window;

沒有window屬性,會(huì)導(dǎo)致黑屏

  • 設(shè)置最低支持版本,比如9.0;最好不要用8.0,太低了,有未知的問題。
image.png

多進(jìn)程等以后成熟了再說,并且最低支持版本最好是iOS13

?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請(qǐng)聯(lián)系作者
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時(shí)請(qǐng)結(jié)合常識(shí)與多方信息審慎甄別。
平臺(tái)聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點(diǎn),簡(jiǎn)書系信息發(fā)布平臺(tái),僅提供信息存儲(chǔ)服務(wù)。

相關(guān)閱讀更多精彩內(nèi)容

  • 用Xcode11創(chuàng)建項(xiàng)目新增SceneDelegate.h這個(gè)文件,AppDelegate文件結(jié)構(gòu)也發(fā)生變化,在A...
    i_MT閱讀 2,084評(píng)論 0 6
  • 一、Python簡(jiǎn)介和環(huán)境搭建以及pip的安裝 4課時(shí)實(shí)驗(yàn)課主要內(nèi)容 【Python簡(jiǎn)介】: Python 是一個(gè)...
    _小老虎_閱讀 6,328評(píng)論 0 10
  • 首先手機(jī)系統(tǒng)升級(jí)為iOS13,相應(yīng)的xcode的版本要升級(jí)為11 注意: 使用xcode 10 編譯的APP 在i...
    若水water閱讀 4,928評(píng)論 2 16
  • Swift1> Swift和OC的區(qū)別1.1> Swift沒有地址/指針的概念1.2> 泛型1.3> 類型嚴(yán)謹(jǐn) 對(duì)...
    cosWriter閱讀 11,643評(píng)論 1 32
  • 級(jí)別: ★☆☆☆☆標(biāo)簽:「iOS13」「Xcode11」「SceneDelegate」作者: dac_1033審校...
    QiShare閱讀 14,516評(píng)論 1 45

友情鏈接更多精彩內(nèi)容