iOS Simulator Error - Black Screen.. Help!

I am having some trouble with the iOS simulator and I was wondering if anyone else had the same problem or had any suggestions. I am very new to xamarin; I just completed the Hello, World tutorial for iOS. I was able to build all with no errors, just one warning about the Pushkit.framework. When I attempt to launch the app in the simulator, it displays the launch image then goes black. I've tried stopping the app, returning to the home page of the simulator and attempting to relaunch from there, but I get the same results. I have already tried resetting the contents and settings of the simulator, and I have made sure there are no breakpoints active that the app might get hung up on in running. Can the pushkit features mentioned by the error cause this problem? Any help would be greatly appreciated!

Answers

  • JohnMillerJohnMiller USForum Administrator, Xamarin Team Xamurai

    @OliviaMurphy,

    It sounds like there might be some missing code in the AppDelegate.cs file. Is there any code to set the initial controller for the app?

    Your FinishedLaunching method should look similar to this.

    public override bool FinishedLaunching(UIApplication application, NSDictionary launchOptions)
        {            
            Window = new UIWindow (UIScreen.MainScreen.Bounds);
            Window.RootViewController = _controller = new TestViewController(); // First screen
            Window.MakeKeyAndVisible ();
    
            return true;
        }
    

    If you are using Storyboards, this may look a little different. If you continue to have trouble, upload your project as a .zip and I will take a look.

  • OliviaMurphyOliviaMurphy USMember

    @JohnMiller I am using Storyboards; this is what is in my FinishedLaunching method:

        // Override point for customization after application launch.
    
        // Code to start the Xamarin Test Cloud Agent
        #if ENABLE_TEST_CLOUD
        Xamarin.Calabash.Start();
        #endif
    
        return true;
    

    Would you like me to upload my project as well?

  • JohnMillerJohnMiller USForum Administrator, Xamarin Team Xamurai

    @OliviaMurphy,

    Sure, that might help me investigate what is going on.

  • JohnMillerJohnMiller USForum Administrator, Xamarin Team Xamurai

    @OliviaMurphy,

    It looks like the storyboard is not set for the Main Interface in the project options. All you'll have to do is set that.

  • OliviaMurphyOliviaMurphy USMember

    @JohnMiller That worked! Thanks for your help!

  • OliviaMurphyOliviaMurphy USMember

    Ok @JohnMiller (or anyone else reading this), I am back with another question. My simulator is working, but my app is loading off center, and when I click the translate button a MonoTouch.Foundation.MonoTouchException is being thrown. It looks like TranslateButton and translatedNumber are unknown identifiers in ViewController.cs. I copied the text word for word for ViewController.cs from the tutorial; it did not have any code that declared those variables.. Isn't that done by the Storyboard? What am I missing? The only change I have made to the previous zip file was setting the storyboard for the Main Interface as suggested to get the simulator working.

  • ChrisBoweChrisBowe USMember ✭✭

    I had such a hard time finding a fix for this, can't believe it was so frickin easy!! I almost had to recreate my whole project :open_mouth:

    My situation was a bit different. What I did was, I wanted to change the application name that displays on the home screen in iOS Simulator. So I set the Application Name to what I wanted, saved, deployed, launch screen shows up, then black screen of death. Before I changed anything, it was perfectly fine! Every time I tried changing a setting back or fixing a setting or namespace or folder directory or whatever, the app kept doing the same thing: launch screen, then BSOD.

    And then I come to find it's because I was setting the Application Name within the Properties window -- not Info.plist. When I set it in Properties and open back up either Properties or Info.plist, the Main Interface becomes unset for some reason. I have to set in Info.plist for it to persist.

    After a bit more testing, it seems that changing ANY setting under iOS Application within the Properties window will persist everything else, but unset the Main Interface. Not sure if this is a bug with VS2013 or Xamarin...

    Visual Studio Premium 2013 12.0.31101.00 Update 4
    Xamarin 5.9.4.5
    Xamarin for Visual Studio extension 3.11.666

    Hope this helps out :smile:

  • OliviaMurphyOliviaMurphy USMember

    @ChrisBowe That may be what happened with my project as well. Thankfully I able to get everything figured out. Thanks for the input!

  • RuudFaessenRuudFaessen NLMember

    @ChrisBowe Thanks! I am using Visual Studio and I was setting the main storyboard like @JohnMiller mentioned in the Properties, not in the info.plist. After setting it in the info.plist it worked fine :smile:

  • BilalBagdadBilalBagdad USMember

    Guys,, I did change the Main Interface.. But I'm still getting a black screen.. !!

  • dcc-mobiledcc-mobile BEMember ✭✭

    @chrisbowe : Thanks for the answer, seems like visual studio is not storing the values in the plist.
    Did a manual edit, and now everything works fine !

  • KrunalShahKrunalShah USMember

    @OliviaMurphy : I am having this black screen on second and third tab. The first tab comes good. I am new to xamarin and I can't find any solution to this problem anywhere. It is just frustrating. Can you please help? I have uploaded the zip file of the project for you to look at it.

  • FinHorsleyFinHorsley USMember ✭✭

    @KrunalShah Found the problem - when you create a segue between the navigation controller and the viewController (e.g. from the navigation controller to View2Controller you need to set the relationship as "Root".

    Solution to your problem is to delete the segues from the NavigationController to View2Controller and myControl, and replace them with segues with the "Root" relationship.

  • KrunalShahKrunalShah USMember

    @FinHorsley : Thank you very much for your great help. It works now.
    I had been thinking that only one can be root and every other options have to be Tab. Now I have a question in what cases it can be "Tab" and not "Root"?
    Thanks once again.

  • FinHorsleyFinHorsley USMember ✭✭

    You want to set it as a "tab" relationship between the tabController and the NavigationController. You then want to set the relationship between the NavigationController and the ViewController (in your case View2Controller) as "root".

Sign In or Register to comment.