After Xcode update to 11, new project, system added a SceneDelegate file.

Before ios13, the APP life cycle and UI life cycle were the responsibility of the APP delegate.

After ios13, that changed. The duties of the Appdelegate are: 1) handle the App lifecycle; 2) Handle the new Scene Session lifecycle

SceneDelegate’s job is to: 1. Handle the UI lifecycle

For developers using Xcode11 to create new projects. Initializing the Window method requires a change. Not in Appdelegate – (BOOL) application: (UIApplication *) application didFinishLaunchingWithOptions: (NSDictionary *)launchOptions are initialized, while the willConnectToSession: method passed to SceneDelegate is set to the root controller:

- (void)scene:(UIScene *)scene willConnectToSession:(UISceneSession *)session options:(UISceneConnectionOptions *)connectionOptions {
    UIWindowScene *windowScene = (UIWindowScene *)scene;
    self.window = [[UIWindow alloc] initWithWindowScene:windowScene];
    self.window.frame = windowScene.coordinateSpace.bounds;
    self.window.rootViewController = [UITabBarController new];
    [self.window makeKeyAndVisible];
}

Copy the code

For devices that need ios13 or lower, delete scenedelegate.

1. Delete the SceneDelegate class file

2. Delete the info.plist phase key value

Restore the window attribute in AppDelegte

Delete the scene method in the AppDelegate

In summary, you can continue to create the UI execution code the same way as before.