AutoLayout and Size Classes causing nibs to not be created

I recently updated Xamain to 5.8.3 and xamarin.ios to 8.9.1.3. Ever since then, I am unable to build my projects.

On all of the xib's that are using auto layout and size classes, when I select build, it gives me the error that the source file for he nib does not exist.

/Library/Frameworks/Mono.framework/External/xbuild/Xamarin/iOS/Xamarin.iOS.Common.targets: Error: Cannot copy /Users/harshshah/Desktop/RimbleApp/Rimble/obj/iPhoneSimulator/Debug/ibtool/CommentPage.nib to /Users/harshshah/Desktop/RimbleApp/Rimble/bin/iPhoneSimulator/Debug/Rimble.app/CommentPage.nib, as the source file doesn't exist. (Rimble)

I am not using storyboard and my minmimum target is set to 7.0. I even reformatted my computer and installed a fresh version of xamarin, but I am still getting the errors. Basically Xamarin is not generating nibs for an xib's that are using autolayout and size classes. I have spent almost 40-45 hours this weekend trying to figure this out, but nothing can fix this. I even recreated my application, designing my xibs from scratch, and still get the error.

I realized that once I do a "Clean" or a "rebuild" it cleans the project, but then it not able to create nibs for any xibs that use autolayout and size classes.

It might be a problem with the target file.

Any help/tips is appreciated with this issue.

Posts

  • AlanMcGovernAlanMcGovern USXamarin Team Xamurai

    @jstedfast Can you take a look?

  • HemangThakkar.0869HemangThakkar.0869 USMember
    edited April 2015

    Yes the same is happening for me as well.

    Basically, in my obj/iphonesimulator/ibtool folder, any xib that has size classes and auto layout, the nib is not being generated. But as soon as i uncheck use size classes, and build, then the nib appears.

    But if i rebuild or clean, then all of the xibs that use auto layout, the nibs are removed

  • JeffreyStedfastJeffreyStedfast USXamarin Team Xamurai

    Aren't Size Classes new in 8.0? That's probably why setting a target of 7.0 is making ibtool fail, and thus the MSBuild system can't copy the compiled nibs (because ibtool failed to create them).

    You'll have to look at your Build Logs, but I suspect that's why.

  • HemangThakkar.0869HemangThakkar.0869 USMember
    edited April 2015

    hmm

  • HarshShahHarshShah USMember

    But that doesn't make sense. It was working before with iOS 7 and iOS 8. My iPhone is iOS 7, and it was working.

    http://stackoverflow.com/questions/24172860/how-can-xcode-6-adaptive-uis-be-backwards-compatible-with-ios-7-and-ios-6

    I am doing compact width, any height

  • JeffreyStedfastJeffreyStedfast USXamarin Team Xamurai

    Look at the Build Logs. Is ibtool invoked on the storyboard files? Did it output any files in your obj/ibtool directory?

  • I'm having the exact same issues. It's with an older application that does NOT use storyboards but the files that it breaks on use size classes. It has worked for months before this update.

  • KurtBurnsKurtBurns USMember
    edited April 2015

    It outputs most of the nib files but several are not generated and therefore unavailable to be copied to destination.

  • MarkPevecMarkPevec USMember, University
    edited April 2015

    I'm having the same issue. iOS builds worked fine before and started failing today with this nib missing error. ibtool outputs everything except for a single nib (from a single xib). Another xib file (thought its just a launchscreen.xib containing just a single UIImageView) builds into a nib fine (both the failing and successfull xib files use size classes and always have). Both xib files can be opened with XcodeIF and appear fine (and unchanged since before this failure started occurring)

  • @jstedfast As Kurt Burns had said, any *.xib files that use "Size Classes" are not output into the obj/ibtool directory. This broke as of the recent Xamarin update and XCode 6.3. This is a huge issue for me can you please help?

  • JeffreyStedfastJeffreyStedfast USXamarin Team Xamurai

    It seems that Xcode 6.3's ibtool program refuses to compile storyboards when you target an older iOS version. Your options are: go back to using Xcode 6.2 (you can install it side-by side with 6.3) or set your Deployment Target value in your Info.plist to 8.x.

  • MarkPevecMarkPevec USMember, University
    edited April 2015

    jstedfast: Is that a temporary solution while you figure out a better fix, or do you consider that a reasonable workaround? (hint: it's not)

  • JeffreyStedfastJeffreyStedfast USXamarin Team Xamurai

    If the bug is that ibtool does not compile your storyboard files when you target iOS older than 8.x, what more can we do? We do not have the source code for ibtool, so we can't fix it.

  • MarkPevecMarkPevec USMember, University

    For me it compiles everything but a single xib file (another xib file compiles fine, it also has 'Use Size Classes' set, as do the storyboard files)

  • JeffreyStedfastJeffreyStedfast USXamarin Team Xamurai
    edited April 2015

    You can check the build logs if you don't believe me, but I guarantee that the build is invoking ibtool on the xib file and I would bet anything that the output by ibtool is empty.

    To verify, check obj/{configuration}/ibtool/{xib filename}.nib

    Is the nib directory empty?

    If so, that's a bug in ibtool and not any Xamarin code.

  • adamkempadamkemp USInsider, Developer Group Leader mod

    What happens when you build an app with size classes in Xcode 6.3 and run it in iOS 7 or 7.1? Does an app built with Xcode 6.3 generate multiple nib files correctly? And what does it do at build time?

    Maybe now you have to invoke ibtool multiple times with different options or something.

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

    I actually just experienced this issue over the weekend working on my own project after adding size classes to an XIB file. I had to change the "Builds for" proper of the XIB/Storyboard to "iOS 8.0 and later". The default setting for new XIBs and Storyboards is "Builds for Project Deployment Target" so if your Project deployment target is < 8.0 then the XIB/Storyboard will try to build against the < 8.0 iOS SDK from Xcode. I did test that if I set my XIB/Storyboard to use size classes and set the Project Deployment Target to 7.0 of the app project (with "Builds for" setting in the XIB/Storyboard to "iOS 8.0 and later") that the XIB/Storyboard was built and I avoided the mentioned error and was able to deploy to an iOS 7 device/simulator without issue.

    Downgrading to Xcode 6.2 also resolved the issue when leaving the "Builds for" property of the XIB/Storyboard to "Project Deployment Target"

  • RobertAltlandRobertAltland USMember ✭✭

    I had the same issue and was able to work around it following similar steps to what JGoldberger suggested. I had trouble getting things in a state where it would include the storyboard, so there may be some unnecessary steps here:

    1) in Xcode set the "Builds for" setting on the storyboard to project deployment target. It may be safe to just leave it there instead of setting something specific?
    2) in Xamarin set the project to target > 8. I had to do this to get it to include the storyboards. I found building for 7.1 straight away still didn't work for me, but maybe I'm doing something wrong.
    3) in Xamarin set the project to target 7.1 and build -- not rebuild

    With these steps I was able to deploy my repro project to the iPhone 4s simulator running iOS 7.1.

  • JGoldbergerJGoldberger USMember, Forum Administrator, Xamarin Team, University Xamurai
    edited April 2015

    Robert,

    That was initially how I resolved it, then I tried setting the "Builds for" property of the XIB/Storyboard to "iOS 8 and later" and that allowed building with the app project's deployment target set to < 8.0 even from a clean build.

    Also Downgrading to Xcode 6.2 resolved the issue.

    And i have filed a bug report: https://bugzilla.xamarin.com/show_bug.cgi?id=29100

  • KurtisBurnsKurtisBurns USMember

    Downgrading to 6.2 worked for me as well

  • MarkPevecMarkPevec USMember, University
    edited April 2015

    JGoldberger: Thanks! Changing the Builds for property fixed my build problem. I had tried doing the build with deployment target 8.0 (to get the xib file to compile) and then changing to 7.0 and doing another build (with no clean in-between so the compiled nib persisted), this worked to get a build to complete but when I tried installing and running that build (on any iOS device) it would crash on start with a runtime error (NSInvalidArgumentException Reason: Could not find a storyboard named Main). When I changed the Builds For property of all my storyboards/Xib files the build works and doesn't crash on iOS8.x devices but still crashes with a runtime error on iOS7.x devices (this new runtime crash on start for iOS7.x devices is Unhandled managed exception: Objective-C exception thrown. Name: NSInvalidUnarchiveOperationException Reason: Could not instantiate class named UIStoryboardPresentationSegueTemplate)

  • JeffreyStedfastJeffreyStedfast USXamarin Team Xamurai

    What did you change your Builds For value to? "7.0 or later"?

  • MarkPevecMarkPevec USMember, University
    edited April 2015

    The last issue (builds fine, works fine on iOS8, crashes on iOS7 with Name: NSInvalidUnarchiveOperationException Reason: Could not instantiate class named UIStoryboardPresentationSegueTemplate) occurs when I set all the storyboards to Builds For '8.0 or later'. When I set the Builds For to 7.0 or later it builds fine but crashes on both iOS7 and iOS8 with the exception NSInvalidArgumentException Reason: Could not find a storyboard named Main). All cases set deployment target as 7.0 (since we want to support iOS7 and iOS8 with our app)

  • AlanMcGovernAlanMcGovern USXamarin Team Xamurai

    We've located the problem and are currently working on a solution!

    Thanks for the report!

  • MarkPevecMarkPevec USMember, University

    AlanMcGovern: Awesome, thanks for the quick support!

  • JohnGomez.8154JohnGomez.8154 USMember

    Quick clarification...

    I am seeing this issue with .png files for iOS from Visual Studio...is this the same issue as the one originally posted in this thread for a different issues? I rather not open a new forum thread if this is the same issue.

    More importantly, if this is the same issue - I take it the fix isn't out yet and that there isn't a work around other than down grading to an earlier version of the tools?

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

    @JohnGomez.8154

    That sounds like a different issue. Can you see if any of the following bug reports seem similar to your scenario?

    https://bugzilla.xamarin.com/show_bug.cgi?id=26606
    https://bugzilla.xamarin.com/show_bug.cgi?id=29100
    https://bugzilla.xamarin.com/show_bug.cgi?id=27665
    https://bugzilla.xamarin.com/show_bug.cgi?id=28299.

    @MarkPevec

    The new issue you brought up is an upstream issue, IOW a bug on Apple's side. See the bug report on it:
    https://bugzilla.xamarin.com/show_bug.cgi?id=29134

  • MarkPevecMarkPevec USMember, University
    edited April 2015

    It looks like the only way to build for iOS7 devices (such that the build doesn't crash on load or during operation) with Xamarin and xCode6.3+ requires converting all the segues to the old deprecated types. Is anyone able to build for iOS7 (without encountering a crash when using adaptive segues) with the adaptive segues, Xamarin, and xCode6.3+?

  • Everyone...I was able to remedy this by (so far)

    using XS 5.8.3 (1)
    Monotuch 8.9.1.3

    Xcode 6.3.1
    But I had to open every storyboard and nib (and launch storyboard) and set Builds For to 7.1

Sign In or Register to comment.