Has something changed with creating new View Controller .xib? (Alpha 4.3.3)

ShaunLynch.9419ShaunLynch.9419 USMember, University

Just spent most of this morning trying to create a new .xib file based project and failing miserably enough to roll back to beta version and compare the differences.

I know that with the 4.3.3 alpha, the focus on file>new project is now storyboard projects but I needed a xib project.

Anyway, I noticed when doing a 'File > New File > View Controller', the format of the xib file is different than doing one using the current stable or beta release.
Basically looking at the file in iB, or viewing the XML shows that in stable or beta modes, the first 'object' after the IBFilesOwner and IBFirstResponder is a view, whereas with the new alpha it's now a viewController.

Just wondering if this is intentional and if so, what syntax changes are necessary in the AppDelegate.cs file (or wherever else) to set up a xib based project and have your viewcontroller load properly? The old boilerplate code - overriding the FinishedLaunching method in AppDelegate.cs, defining the window, adding the viewcontroller as the window.RootViewController and calling window.MakeKeyAndVisible throws an error at runtime.
(Objective-C exception thrown. Name: NSInternalInconsistencyException Reason: -[UIViewController _loadViewFromNibNamed:bundle:] loaded the "viewAlpha" nib but the view outlet was not set.)

Just a little confused right now, wondering if you've documented these changes to the nib file somewhere?


  • AlanMcGovernAlanMcGovern USXamarin Team Xamurai

    I've been trying to go through this workflow and the methodology which used to work with older style xibs does not work with newer style xibs.

    I also hit the same issue as you and the 'normal' way to fix that would be to open the xib in Xcode, make sure the ViewController has a UIView inside it and then make that UIView the 'View' outlet on the viewcontroller. However iOS still refuses to accept my xib even after I made that change.

    I've contacted the Docs team and people more familiar with iOS to try and figure out exactly what has changed.

  • AlanMcGovernAlanMcGovern USXamarin Team Xamurai

    We've identified the issue that was introduced when upgrading the Xib files to Xcode 5 format. It was an unintentional functional change to the xib files and is exactly as you described - we changed the toplevel to be a UIViewController instead of a UIView.

    For now there's a simple workaround you can try: http://screencast.com/t/uO8R7IFh . We will adjust the default templates appropriately to prevent other people running into this issue.

Sign In or Register to comment.