Bug 2451 - Monotouch 5 applications are crashing on iPhone 3.0 because of problems reading NIB files
Summary: Monotouch 5 applications are crashing on iPhone 3.0 because of problems readi...
Status: RESOLVED FIXED
Alias: None
Product: Xamarin Studio
Classification: Desktop
Component: iOS add-in ()
Version: unspecified
Hardware: Macintosh Mac OS
: High normal
Target Milestone: ---
Assignee: Ethan Chang
URL:
Depends on:
Blocks:
 
Reported: 2011-12-10 05:45 UTC by janj0un
Modified: 2012-03-14 14:28 UTC (History)
4 users (show)

Tags:
Is this bug a regression?: ---
Last known good build:


Attachments
crash report and console output from iphone device (26.76 KB, text/plain)
2011-12-10 05:45 UTC, janj0un
Details


Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.


Please create a new report on Developer Community or GitHub with your current version information, steps to reproduce, and relevant error messages or log files if you are hitting an issue that looks similar to this resolved bug and you do not yet see a matching new report.

Related Links:
Status:
RESOLVED FIXED

Description janj0un 2011-12-10 05:45:26 UTC
Created attachment 1030 [details]
crash report and console output from iphone device

Compiling any application after editing XIB in XCode 4.2 results in an iPhone application that crashes whenever it tries to load any NIB files (Crashes on iPhone OS 3.0.1, works correctly on iPhone OS 4 devices)

Interestingly enough, reverting back to the old XIBs (Edited in XCode 3.2.x) will not restore the correct operation of the application. 

However, this problem doesn't seem limited to solutions migrated from Monotouch 4/XCode 3. 

Steps to reproduce the Error with a wizard generated application: (Please not that the same template generated application compiled on XCode will run correctly on the device after doing the same appropriate steps, so it's not a bug in the XCode support for iPhone OS 3.0)

1- Create a New Monotouch Tabbed iPhone Application.
2- Edit XIB files in XCode and change Interface Builder Document Versionning to iOS 3.0 and Interface Builder 3.0 so that the XIB will be compatible with iOS 3.0
3- in AppDelegate.cs, change 
window.RootViewController = tabBarController ;
to 
window.AddSubView(tabBarConatroller.View);
4- Add an empty override OnActivate function ( I don't know if that is required but previous templates of Monotouch use to say that this is a requirement for correct iPhone OS 3.0 operation)
5- Change Deployment Target to 3.0
6- Deploy to the Device. (tested on iPhone OS 3.0.1 on 3GS)



The application will crash while it is trying to load the XIB file for the first controller.
Comment 1 janj0un 2011-12-10 06:11:05 UTC
This is the build task that actually builds the XIB for use within the App Bundle in XCode.

CompileXIB test/en.lproj/MKT_FirstViewController.xib
    cd /Users/Jhony/Desktop/test
    setenv IBC_MINIMUM_COMPATIBILITY_VERSION 3.0
    setenv PATH "/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin:/Developer/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin"
    setenv XCODE_DEVELOPER_USR_PATH /Developer/usr/bin/..
    /Developer/usr/bin/ibtool --errors --warnings --notices --output-format human-readable-text --compile /Users/Jhony/Library/Developer/Xcode/DerivedData/test-apqyuksfvjhrdmcwrpcmnmqoidav/Build/Products/Debug-iphoneos/test.app/en.lproj/MKT_FirstViewController.nib /Users/Jhony/Desktop/test/test/en.lproj/MKT_FirstViewController.xib --sdk /Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS5.0.sdk



Compared to the compilation of XIB with Monotouch:
/Developer/usr/bin/ibtool --errors --warnings --notices --output-format human-readable-text "/Users/Jhony/Projects/test4/test4/FirstViewController.xib" --compile "/Users/Jhony/Projects/test4/test4/bin/iPhone/Release/test4.app/FirstViewController.nib" --sdk "/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS5.0.sdk"


NOTABLE DIFFERENCE:
--------------------

setenv IBC_MINIMUM_COMPATIBILITY_VERSION 3.0

Probably this environment variable actually forces compilation to a NIB format that is compatible with iOS 3.0
Comment 2 janj0un 2011-12-10 06:46:22 UTC
QUICK FIX:

Go to Terminal.
Set Environment Varialbe:

IBC_MINIMUM_COMPATIBILITY_VERSION=3.0
export IBC_MINIMUM_COMPATIBILITY_VERSION

Compile Project with Command Line tools.

Upload App to Device with Command Line tool.

The resulting application works correctly on the iOS 3.0 device.
Comment 3 Rolf Bjarne Kvinge [MSFT] 2011-12-12 17:53:09 UTC
This looks like something MonoDevelop should take care of.

=> MonoDevelop.
Comment 4 Alan McGovern 2011-12-22 05:42:21 UTC
This fix was committed several says ago to git but I lack an iOS 3 device to actually test it. I don't want to close this until the issue has been verified as fixed.
Comment 5 janj0un 2011-12-26 04:57:44 UTC
We do keep an iPhone with iOS 3.0 for testing purposes. 

As it's holiday season, It might take me a few days before I'm able to do so, but I will try building mono from GIT within the next few days and will let you know the outcome
Comment 6 janj0un 2011-12-27 19:40:24 UTC
This  component looks like its not part of the regular monodevelop build but  part of the monotouch licensed product.

Let me know if that's not the case, so that I test it. 
I will also be ready to test a build if you can provide me with one.
Comment 7 Jeffrey Stedfast 2012-02-15 15:21:45 UTC
Correct, this is part of the MonoTouch Add-in for MonoDevelop and not part of the regular MonoDevelop build.
Comment 8 Jeffrey Stedfast 2012-03-14 14:28:09 UTC
this was fixed as part of 2.8.8