不显示AppDelegate中的第一个ViewController

我有一个内部被涂成红色的UIViewController,我想在第一个屏幕上看到这个viewController,但是从不以ViewController开头,我在做什么错了?

UIWindow window;
        [Export("window")]
        public UIWindow Window { get; set; }

        [Export("application:didFinishlaunchingWithOptions:")]
        public bool Finishedlaunching(UIApplication application,NSDictionary launchOptions)
        {
            window = new UIWindow(UIScreen.MainScreen.Bounds);
            View view = new View();
            UINavigationController navigationmain = new UINavigationController(view);


            window.MakeKeyAndVisible();
            window.RootViewController = navigationmain;
            return true;
        }

我收到此错误: Proyect [4195:115403] SecTaskLoadEntitlements失败error = 22 cs_flags = 200,pid = 4195  Proyect [4195:115403] SecTaskCopyDebug说明:Proyect [4195] / 0#-1 LF = 0  Proyect [4195:115403] SecTaskLoadEntitlements失败error = 22 cs_flags = 200,pid = 4195  Proyect [4195:115403] SecTaskCopyDebug描述:Proyect [4195] / 0#-1 LF = 0

yuanyuanlizhu 回答:不显示AppDelegate中的第一个ViewController

  

在iOS 13(及更高版本)上,场景委托接管了以下角色:   应用程序委托。最重要的是,窗口的概念是   取而代之的是场景。一个应用可以包含多个场景,并且   现在,一个场景用作应用程序的用户界面的背景,并且   内容。

从iOS 13开始,SceneDelegate负责设置应用程序的场景以及设置其初始视图。

[Export ("scene:willConnectToSession:options:")]
public void WillConnect (UIScene scene,UISceneSession session,UISceneConnectionOptions connectionOptions)
{
    // Use this method to optionally configure and attach the UIWindow `window` to the provided UIWindowScene `scene`.
    // If using a storyboard,the `window` property will automatically be initialized and attached to the scene.
    // This delegate does not imply the connecting scene or session are new (see UIApplicationDelegate `GetConfiguration` instead).

    UIWindowScene myScene = scene as UIWindowScene;
    Window = new UIWindow(myScene);
    UIViewController viewController = new UIViewController();
    UINavigationController navigationMain = new UINavigationController(viewController );
    Window.RootViewController = navigationMain;
    Window.MakeKeyAndVisible();
}

有关更多信息,您可以阅读this articlewatch the official video of Optimizing App Launch in iOS13

本文链接:https://www.f2er.com/3157161.html

大家都在问