Windows 中 VS2017 上的 Xamarin iOS 模拟器显示黑屏 [英] Xamarin iOS Simulator on VS2017 in Windows Showing Black Screen

查看:60
本文介绍了Windows 中 VS2017 上的 Xamarin iOS 模拟器显示黑屏的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在 Windows 上使用 Xamarin 运行 Visual Studio 2017 版本 15.3.4.我是 iOS 新手.我做了两个 iOS 项目来测试:一个空白的 iOS 应用程序,我在其中添加了 MainAppViewController.cs 和 MainAppViewController.xib.Info.plist 主界面设置为 MainAppViewController.AppDelegate 是:

I am running Visual Studio 2017 version 15.3.4 with Xamarin on Windows. I'm newbie in iOS. I did two iOS projects to test: a blank iOS app in which I added a MainAppViewController.cs and MainAppViewController.xib. Info.plist main interface is set to MainAppViewController. AppDelegate is:

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

        MainAppViewController mainViewController = new MainAppViewController();
        // If you have defined a root view controller, set it here:
        Window.RootViewController = mainViewController;

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

        return true;

当我运行应用程序并启动 iOS 模拟器时,它在模拟器上显示黑屏.模拟器工作(主页、设置等)上没有按钮.显然,我已连接到 MAC 代理来执行此操作.

When I run app and launchs the iOS Simulator, it is showing a black screen on the simulator. No buttons on simulator work (home, settings, etc.). Obviouslly I'm connected to a MAC agent to do that.

当我在 MAC 中使用 VS2017 社区测试同一个项目时,完美运行.我检查了 info.plist 并且由于某些原因主界面是(无),无论我是否正确设置,当我重新打开时它显示(无).我从 MAC 上的 VS2017 中的同一个项目中复制了 info.plist,同样的问题:黑屏.

When I tested the same project by using VS2017 community in MAC, works perfectly. I checked info.plist and for some reasons Main Interface is (none), no matter if I set it correctly, it shows (none) when I reopen. I copied info.plist from same project in VS2017 on MAC and same problem: Black Screen.

为了检查我是否做错了什么,我重新打开了一个项目,该项目使用我几个月前做过的带有导航控制器的故事板,并且它在 Windows 上的 Visual Studio 2017 中的 iOS 模拟器中的同一台 PC 上完美运行时间,突然它现在不起作用了.在 Windows 上的 iOS 模拟器上显示相同的黑屏.我在 MAC 上测试了这个应用程序,它运行良好.

To Check if I'm doing some wrong, I reopened a project that uses a Storyboard with a Navigation Controller that I did some months ago and it worked perfectly on same PC in the iOS simulator in Visual Studio 2017 on Windows at that time, and suddenly it not worked now. Shows same Black Screen on iOS simulator on Windows. I tested this app on MAC and it works perfectly.

最近我用最新版本更新了 VS2017.

Recently I updated VS2017 with latest releases.

推荐答案

我检查了 info.plist 并且由于某些原因主界面是(无),无论我是否设置正确,当我重新打开时它显示(无).

I checked info.plist and for some reasons Main Interface is (none), no matter if I set it correctly, it shows (none) when I reopen.

如果你在你的应用中使用storyboard作为主界面,你必须在info.plist中设置它,打开info.plistXML(Text) Editor,你可以在那里看到UIMainStoryboardFile.

If you use storyboard as main interface in your app, you must set it in info.plist, open info.plist with the way XML(Text) Editor,you can see UIMainStoryboardFile there.

但我看到你使用一个 xib 类作为主界面,并在 AppDelegate 中以编程方式设置它,这样你就不需要在 plist 中设置主界面.

But I see you use a xib class as the main interface , and set it programmatically in AppDelegate , in the way you don't need set main interface in plist.

当我在 MAC 中使用 VS2017 社区测试同一个项目时,完美运行.

When I tested the same project by using VS2017 community in MAC, works perfectly.

我也遇到了你的问题,我想可能是 MAC 代理出了问题.

I'm also facing your problem , I guess maybe something wrong with MAC agent.

以上操作后,如果还是不行,

After doing that above, if it still doesn't work,

  • 修改构建配置,再次运行.

  • Modify the build configuration ,run again.

关闭应用程序,删除项目中的 binobj 文件夹,然后清理并再次运行.

Close the application, delete the bin and obj folder in your project, then clean and run again.

重新连接 mac 代理.

Reconnect the mac agent.

重新启动 Windows PC 和 Mac.

Restart your windows PC and Mac.

尝试我提供的解决方案(根据优先级).

Try the solution I provide(according to the priority).

这篇关于Windows 中 VS2017 上的 Xamarin iOS 模拟器显示黑屏的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆