Forum Visual Studio

XIB Edit from XCode- Crashes App - Bug?

Am new to Xamarin and evaluating Xamarin. My team has been doing .NET/Web stuff for a long time. for this issue i have been Using VS2013 (PC), latest Xamarin studio (Mac), Latest XCode (Mac).

I have test app: Using XIB for the UI (instead of adding controls programmatically). Have a 3 Screen application. Everything is/was working fine. Then i went to add a label to a page: Open Mac, open Project on Xamarin Studio. Double-click XIB (LandingPage.xib) XCode UIBuilder opens, drag a label onto the screen (the screen only has 2 custom buttons and an imageview). Then control Drag to get the outlet. Name provided for label is LabelDebugOut (though have tried with a few names few times and can consistently reproduce the issue). Go to file Save. Switch back to Xamarin Studio wait till the top status bar says refreshing from XCode (sometimes have to save 2x). Close solution in Xamarin studio. Go back to Visual Studio on PC... Hit debug and the app fails on load: at: AppWindow.MakeKeyAndVisible();

If i revert code back and build it runs fine. Every time i edit the XIB that way it fails. On the other 2 screens i was able to edit/return/edit without issue.

Is my process wrong? is there anything i can do to keep using the GUI Interface Builder? I have not tried the new Xamarin one, can't get that to launch...

Any help is greatly appreciated. Hope the explanation was thorough enough.

Here's the code but i don't think it has to do with code since the exact same code works if the xib is not touched.

// class-level declarations
UIWindow AppWindow;
public SEWS SESvc;

    //
    // This method is invoked when the application has loaded and is ready to run. In this 
    // method you should instantiate the window, load the UI into it and then make the window
    // visible.
    //
    // You have 17 seconds to return from this method, or iOS will terminate your application.
    //
    public override bool FinishedLaunching(UIApplication app, NSDictionary options)
    {
        // create a new window instance based on the screen size
        AppWindow = new UIWindow(UIScreen.MainScreen.Bounds);

        var rootNavigationController = new UINavigationController();

        // If you have defined a view, add it here:
        LandingPage landingPage = new LandingPage();

        rootNavigationController.PushViewController(landingPage, false);
        rootNavigationController.NavigationBar.Hidden = true;
        // make the window visible
        AppWindow.RootViewController = rootNavigationController;
        AppWindow.MakeKeyAndVisible();

        return true;
    }

Answers

  • JGoldbergerJGoldberger USMember, Forum Administrator, Xamarin Team, University Xamurai

    @AD3L1‌

    Hi, is it possible that you created your outlet by dragging into the .m file rather than the .h file? IN Xcode 5, when opening the assistant editor for an XIB, the .m file is opened by default, not the .h file. Creating an outlet in the .m file does not work. Make sure that you are control-dragging into the .h file.

    That may or may not be it, but it is the first thought that came to my head.

    All the best

    Jon

Sign In or Register to comment.