新情况
更新到XCode11
之后,老项目没关系,但是新建项目,和以前完全不一样了。增加了SceneDelegate
,据说是为了iPad
的多进程准备的。
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
比较好。
-
直接删除
SceneDelegate
文件,包括.h,.m
-
删除
info.plist
中的Application Scene Manifest
选项 -
删除
AppDelegate.m
中关于SceneDelegate
的函数。 -
在
AppDelegate.h
中添加window
属性
@property (strong, nonatomic) UIWindow *window;
没有
window
属性,会导致黑屏
- 设置最低支持版本,比如9.0;最好不要用8.0,太低了,有未知的问题。
多进程等以后成熟了再说,并且最低支持版本最好是iOS13
网友评论