Reputation: 2391
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;
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.
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.
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.
Recently I updated VS2017 with latest releases.
Upvotes: 1
Views: 7577
Reputation: 161
I figured this out after a few hours.
My issue was at the Info.plist, below what I did on Visual studio for windows:
in my case Source was set as none.
Upvotes: 0
Reputation: 21213
Its not clear to me from the Q whether the iOS Simulator was being displayed on Mac screen, or on PC screen.
In my situation, I had just run simulator on Mac from VS Mac, to be sure it was working and up-to-date. I was expecting to then show it on Mac, from VS on PC.
HOWEVER I did not know that VS 2017 on PC had:
Tools / Options / Xamarin / iOS Settings / Remote Simulator to Windows CHECKED.
(Which means to show simulator on the PC itself. "Remote" is w.r.t. OSX host that
is actually running the simulator code.)
I stopped debugging on Mac.
Then debugged remote from PC.
The Mac simulator restarted [on Mac monitor], but simulator screen was black.
[As if part of the code thought it should show on Mac, but then the screen image was sent into limbo, trying to go to PC - but there was no window on PC to show it.]
Fix:
Result: Simulator on Mac started up correctly.
If anything goes wrong:
NOTE: If haven't run simulator since XCode has updated, may need to first launch XCode, go to your account in preferences, re-enter your Mac password.
May also need to wait up to 10 minutes on simulator first launch.
I suspect it is installing something.
Upvotes: 1
Reputation: 14475
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.
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.
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.
When I tested the same project by using VS2017 community in MAC, works perfectly.
I'm also facing your problem , I guess maybe something wrong with MAC agent.
After doing that above, if it still doesn't work,
Close the application, delete the bin
and obj
folder in your project, then clean and run again.
Reconnect the mac agent.
Restart your windows PC and Mac.
Try the solution I provide(according to the priority).
Upvotes: 4
Reputation: 79
My black screen on startup issue in VS2017 targeting the iOS simulator was resolved after overriding the Window property in AppDelegate, as illustrated in this video: "How to fix black screen after App startup in Xamarin.iOS" https://www.youtube.com/watch?v=UVkbkXCm1vU
Info.plist seemed to be working/saving just fine. Deleting bin/obj directories, cleaning, rebuilding, etc. didn't help (for the obvious reason that my code was incorrect).
Thanks,
a.s.
Upvotes: 0