1.先直接刪除SceneDelegate.h/.m文件
2.在AppDelegate.h添加@property (strong, nonatomic) UIWindow * window;屬性
#import <UIKit/UIKit.h>
@interface AppDelegate : UIResponder <UIApplicationDelegate>
@property (strong, nonatomic) UIWindow * window;
@end
複製代碼
3.移除UIScene代理
移除以前
#import "AppDelegate.h"
@interface AppDelegate ()
@end
@implementation AppDelegate
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
// Override point for customization after application launch.
return YES;
}
#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.
}//移除
@end
複製代碼
移除以後
#import "AppDelegate.h"
@interface AppDelegate ()
@end
@implementation AppDelegate
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
// Override point for customization after application launch.
return YES;
}
@end
複製代碼
4.最後在info.plist文件中移除Application Scene Manifest
Swift移除同理
1.先直接刪除SceneDelegate.swift 文件
2.在AppDelegate.swift 中添加 window 屬性 var window: UIWindow?
修改前
@main
class AppDelegate: UIResponder, UIApplicationDelegate {
複製代碼
修改後
import UIKit
@UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate {
var window: UIWindow?
複製代碼
3.移除UIScene代理
4.最後在info.plist文件中移除Application Scene Manifest
5.建立本身的Window
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
//設置全局顏色
UITabBar.appearance().tintColor = UIColor.orange
// 建立Window
window = UIWindow(frame: UIScreen.main.bounds)
window?.rootViewController = MainTabViewController();
window?.makeKeyAndVisible()
return true
}
複製代碼