Bug 38438 - App does not compile with xcode 6.0
Summary: App does not compile with xcode 6.0
Alias: None
Product: iOS
Classification: Xamarin
Component: Xamarin.iOS.dll ()
Version: XI 9.8 (tvOS / C7)
Hardware: PC Windows
: --- normal
Target Milestone: Untriaged
Assignee: Bugzilla
Depends on:
Reported: 2016-02-04 10:55 UTC by Sushil
Modified: 2016-02-05 11:33 UTC (History)
2 users (show)

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

This is the log file. (1000.63 KB, application/msword)
2016-02-04 14:34 UTC, Sushil

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:

Description Sushil 2016-02-04 10:55:52 UTC
I need to build my app for ios 9.0 with XCode 6.0 however it used to crash. So I updated the XCode (keeping both 6.0 and 7.2) and xamarin studio.

Now when I build the app with xcode 6.0 I get the following error. However when built with xcode 7.1 (xcode 7.2 still crashes ) this works properly but I get design issues because my design is in xcode 6.0.

My Monotouch version is:

******************************** Error ********************************************

obj/iPhone/Ad-Hoc/mtouch-cache/registrar.m:17664:93: error: cannot find protocol declaration for 'UIBarPositioningDelegate'		@interface MonoTouch_UIKit_UISearchBar__UISearchBarDelegate : NSObject<UISearchBarDelegate, UIBarPositioningDelegate> {
		1 warning and 1 error generated.
MTOUCH: error MT4109: Failed to compile the generated registrar code. Please file a bug report at http://bugzilla.xamarin.com
	Task "MTouch" execution -- FAILED
	Done building target "_CompileToNative" in project  -- FAILED
Comment 1 Rolf Bjarne Kvinge [MSFT] 2016-02-04 11:31:41 UTC
UIBarPositioningDelegate was introduced in iOS 7, so this looks a bit strange since Xcode 6 shipped with an SDK for iOS 8.

Please add "-v -v -v -v" to the additional mtouch arguments in the project's iOS Build options, rebuild the app and attach the complete build log.
Comment 2 Sushil 2016-02-04 12:04:19 UTC
Yes that's strange, because the same code used to compile earlier before updating. The only problem then was it did not launch on ios 9.

Here is the build log for the error, the full log was thousands of lines big. So i am attaching a small portion of it.

It mainly says the runtime version is unavailable. Please have a look.

/Users/proj/Projects/02 Feb 2016_Testing/ProjectName/iPadProjectName/obj/iPhone/Ad-Hoc/mtouch-cache/registrar.m:18020:93: error: cannot find protocol declaration for 'UIBarPositioningDelegate'
@interface MonoTouch_UIKit_UISearchBar__UISearchBarDelegate : NSObject<UISearchBarDelegate, UIBarPositioningDelegate> {
1 warning and 1 error generated.

WARNING: The runtime version supported by this application is unavailable.
Using default runtime: v4.0.30319
Mono Ahead of Time compiler - compiling assembly /Users/proj/Projects/02 Feb 2016_Testing/ProjectName/iPadProjectName/obj/iPhone/Ad-Hoc/mtouch-cache/Build/ProjectName.exe
Code: 1444980(86%) Info: 41324(2%) Ex Info: 37530(2%) Unwind Info: 9324(0%) Class Info: 56532(3%) PLT: 1850(0%) GOT Info: 47058(2%) Offsets: 27471(1%) GOT: 24952
Compiled: 4970/4970 (100%), No GOT slots: 2803 (/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang  -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS6.0.sdk -Qunused-arguments -miphoneos-version-min=6.0 -arch armv7s -c -o "/Users/proj/Projects/02 Feb 2016_Testing/ProjectName/iPadProjectName/obj/iPhone/Ad-Hoc/mtouch-cache/ProjectName.exe.armv7s.o" -x assembler "/Users/proj/Projects/02 Feb 2016_Testing/ProjectName/iPadProjectName/obj/iPhone/Ad-Hoc/mtouch-cache/ProjectName.exe.armv7s.s"
56%), Direct calls: 1575 (36%)
Output file: '/Users/proj/Projects/02 Feb 2016_Testing/ProjectName/iPadProjectName/obj/iPhone/Ad-Hoc/mtouch-cache/ProjectName.exe.armv7s.s'.
Linking symbol: '_mono_aot_module_ProjectName_info'.
JIT time: 3845 ms, Generation time: 7815 ms, Assembly+Link time: 40 ms.

Process exited with code 1, command:
Comment 3 Rolf Bjarne Kvinge [MSFT] 2016-02-04 12:28:34 UTC
@Sushil, could you save the complete output to a file and attach it here? There is other information in the build log that might be important.
Comment 4 Sushil 2016-02-04 14:34:17 UTC
Created attachment 14897 [details]
This is the log file.
Comment 5 Rolf Bjarne Kvinge [MSFT] 2016-02-04 17:14:28 UTC
You're using the iOS 6.0 SDK:

> Xamarin.iOS (monotouch-9.1.0-branch: bae2cdb) Business Edition using framework: /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS6.0.sdk

Try selecting "Default" as "SDK Version" in your project's iOS Build options.
Comment 6 Sushil 2016-02-05 01:05:09 UTC
yes that's how it's meant to be. I need the project to be compiled with 6.0 sdk. I have multiple ios sdks installed. The app builds and runs properly with higher version sdk but then I loose my design gets disturbed since it was built on 6.0.

Strange but this used to build with 6.0 sdk before i upgraded on the same box. Please suggest what else can I try.
Comment 7 Sushil 2016-02-05 01:08:36 UTC
I am really sorry for the confusion, I did not mean XCode 6.0, I meant iOS sdk 6.0
Comment 8 Rolf Bjarne Kvinge [MSFT] 2016-02-05 09:13:48 UTC
If you must build with an older iOS SDK, then you can't use any class/protocol introduced in a later SDK.

UISearchBarDelegate inherits from UIBarPositioningDelegate, which was introduced in iOS 7.0, which means you can't use UISearchBarDelegate (which is used internally if you use UISearchBar).

In any case this is not a sustainable solution, sooner or later you'll run into something that can't be solved if you insist on using a newer version of Xamarin.iOS with an older iOS SDK / Xcode. The solution is to solve any issues you have when using the proper SDK.
Comment 9 Sushil 2016-02-05 10:21:21 UTC
I know this that UIBarPositioningDelegate was introduced in iOS 7.0, but I still have machines which build the same code successfully using iOS 6.0 SDK. but then my app does not launch in iPad mini 2 with iOS 9.

People said that I need the latest XCode to rebuild the app for iOS 9. The problem comes only in this one machine where I have upgraded my Xamarin Studio and XCode to the latest one.

Not Sure if any one else faced the same issue.
Comment 10 Rolf Bjarne Kvinge [MSFT] 2016-02-05 10:30:09 UTC
This is not a bug in Xamarin.iOS; we do not support building with the iOS 6.0 SDK anymore.

You need to fix the issues in your app that shows up when building with the latest SDK.
Comment 11 Sushil 2016-02-05 10:45:35 UTC
Ohh. Is there a way I can run an app built on ios 6.0 SDK on iOS 9 devices? In that case I can use my old Xamarin studio and XCode to support my app. Because redesigning the whole app is not feasible. 

Please advice.
Comment 12 Rolf Bjarne Kvinge [MSFT] 2016-02-05 11:00:29 UTC
Building using the iOS 6.0 requires using an old version of Xamarin.iOS (and an old version of Xcode and an old version of Xamarin Studio), but older versions of Xamarin.iOS do not work on iOS 9 (the oldest version of Xamarin.iOS that works in iOS 9 is Xamarin.iOS [1], which requires Xcode 6 and the iOS 8.0 SDK). 

So unfortunately no, there's no supported way to run a Xamarin.iOS app built with the iOS 6.0 SDK on iOS 9.

[1] https://developer.xamarin.com/releases/ios/xamarin.ios_8/xamarin.ios_8.10/#1.74
Comment 13 Sushil 2016-02-05 11:19:20 UTC
I just built an app on IOS SDK 6.0 and the app is running perfectly on my ipad mini 2 running ios 9.2.1
Comment 14 Rolf Bjarne Kvinge [MSFT] 2016-02-05 11:33:08 UTC
There's no *supported* way, that doesn't mean you might get lucky and it happens to work.

It does however mean that if you run into problems you're on your own.