Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/290.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# Xamarin.iOS:启动后黑屏,无情节提要_C#_Ios_Xamarin - Fatal编程技术网

C# Xamarin.iOS:启动后黑屏,无情节提要

C# Xamarin.iOS:启动后黑屏,无情节提要,c#,ios,xamarin,C#,Ios,Xamarin,我不想在我的Xamarin.iOS应用程序中使用情节提要,因此我做了以下操作: 1-删除情节提要文件 2-将plist.info文件应用程序>主界面更新为无值 3-将以下代码添加到AppDelegate文件中 [Export ("application:didFinishLaunchingWithOptions:")] public bool FinishedLaunching (UIApplication application, NSDictionary launchOptions) {

我不想在我的Xamarin.iOS应用程序中使用情节提要,因此我做了以下操作:

1-删除情节提要文件

2-将plist.info文件应用程序>主界面更新为无值

3-将以下代码添加到
AppDelegate
文件中

[Export ("application:didFinishLaunchingWithOptions:")]
public bool FinishedLaunching (UIApplication application, NSDictionary launchOptions)
{
    // create a new window instance based on the screen size
    Window = new UIWindow(UIScreen.MainScreen.Bounds);

    var controller = new UIViewController();
    controller.View.BackgroundColor = UIColor.LightGray;
    controller.Title = "My Controller";

    var navController = new UINavigationController(controller);

    Window.RootViewController = navController;

    // make the window visible
    Window.MakeKeyAndVisible();

    return true;
}
但这样做后,我收到了一个黑屏上的模拟器后,发射屏幕完成。即使是全新的项目也会出现这种情况。我上传了一个带有这些步骤和问题的示例新项目

我使用的是Visual Studio 2019-Xamarion.iOS 11.8.3-XCode 11.3

我最近使用Visual Studio 2015时没有任何问题,我认为这个问题只发生在Visual Studio 2019上。不幸的是,目前我没有Visual Studio 2015可供试用。

从iOS 13开始,负责设置应用程序的场景,将代码从
AppDelegate
移动到
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 controller = new UIViewController();
    controller.View.BackgroundColor = UIColor.LightGray;
    controller.Title = "My Controller";

    UINavigationController navigationMain = new UINavigationController(controller);
    Window.RootViewController = navigationMain;
    Window.MakeKeyAndVisible();
}
请参阅:从iOS 13开始,负责设置应用程序的场景,将代码从
AppDelegate
移动到
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 controller = new UIViewController();
    controller.View.BackgroundColor = UIColor.LightGray;
    controller.Title = "My Controller";

    UINavigationController navigationMain = new UINavigationController(controller);
    Window.RootViewController = navigationMain;
    Window.MakeKeyAndVisible();
}
参考:及