gpt4 book ai didi

ios - 不显示来自 AppDelegate 的第一个 ViewController

转载 作者:行者123 更新时间:2023-11-28 23:25:59 24 4
gpt4 key购买 nike

我有一个内部漆成红色的 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 failed error=22 cs_flags=200, pid=4195
Proyect[4195:115403] SecTaskCopyDebugDescription: Proyect[4195]/0#-1 LF=0
Proyect[4195:115403] SecTaskLoadEntitlements failed error=22 cs_flags=200, pid=4195
Proyect[4195:115403] SecTaskCopyDebugDescription: Proyect[4195]/0#-1 LF=0

最佳答案

On iOS 13 (and up), the scene delegate takes over some of the roles of the app delegate. Most importantly, the concept of a window is replaced by that of a scene. An app can have more than one scene, and a scene now serves as the backdrop for your app’s User Interfaces and content.

从 iOS 13 开始,SceneDelegate负责设置您应用的场景,以及设置他们的初始 View 。

[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

关于ios - 不显示来自 AppDelegate 的第一个 ViewController,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58717629/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com