XCode11新增SceneDelegate

2019-11-11  本文已影响0人  勇往直前888

新情况

更新到XCode11之后,老项目没关系,但是新建项目,和以前完全不一样了。增加了SceneDelegate,据说是为了iPad的多进程准备的。

image.png

AppDelegate.m中增加了关于SceneDelegate的函数。

#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

如果没有多进程需求,那么还是去掉这个多余的SceneDelegate比较好。

@property (strong, nonatomic) UIWindow *window;

没有window属性,会导致黑屏

image.png

多进程等以后成熟了再说,并且最低支持版本最好是iOS13

上一篇下一篇

猜你喜欢

热点阅读