IOS13以后新增SceneDelegate怎样删除以恢复之前

1、删除新增的SceneDelegate.h跟SceneDelegate.m两个类

2、在info.plist 中删除Application Scene Manifest

3、在AppDelegate.h中添加 @property (strong, nonatomic) UIWindow *window;

4、在AppDelegate.m中的didFinishLaunchingWithOptions方法中写

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {

    // Override point for customization after application launch.

    self.window = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds];

    self.window.backgroundColor = [UIColor orangeColor];

//    self.window.rootViewController = baseNav;

    self.window.rootViewController = [[UIViewController alloc] init];

    [self.window makeKeyAndVisible];

    return YES;

}

5、最后在main.m文件中写

int main(int argc, char * argv[]) {

    @autoreleasepool {

        // Setup code that might create autoreleased objects goes here.

        return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class]));

    }

}

这样就完事了。切记didFinishLaunchingWithOptions中一定要写self.window.rootViewController,否则会崩溃!!!

你可能感兴趣的:(IOS,开发常见问题,ios)