Re: Xcode 8 - XCODE_VERSION_MAJOR causes compilation issue
Re: Xcode 8 - XCODE_VERSION_MAJOR causes compilation issue
- Subject: Re: Xcode 8 - XCODE_VERSION_MAJOR causes compilation issue
- From: David Duncan <email@hidden>
- Date: Thu, 11 Aug 2016 04:03:30 -0700
> On Aug 11, 2016, at 12:09 AM, Sasikumar JP <email@hidden> wrote:
>
> Hi,
> Xcode defines following build variables, we can not use them in Xcode 8
> as the values are invalid octal number.
>
> XCODE_VERSION_ACTUAL = 0800
> XCODE_VERSION_MAJOR = 0800
> XCODE_VERSION_MINOR = 0800
Sounds like you should write up a bug for this, but I’m not really aware of what the use case for comparing the Xcode version would be to be honest...
>
>
> I am working on iOS project, it should be compilable in both Xcode 7 and Xcode 8.
> I am planning to add the conditional compilation like below
>
> preprocessor macro:
>
> XCODE_VERS=$(XCODE_VERSION_MAJOR)
>
>
> #if XCODE_VERS > 0700
>
> @interface SampleTableCell : UITableViewCell<CAAnimationDelegate>
>
> #else
>
> @interface SampleTableCell : UITableViewCell
>
> #endif
>
>
> But this code throws the compilation error (Invalid digit '8' in octal
> constant) in Xcode 8, since 0800 is not a valid octal value.
>
> Is there any work around other than creating 2 different targets(separate
> target for Xcode 7 and Xcode 8)
You don’t want the Xcode version here, you want the iOS SDK version, which in this case is represented by the conditional "__IPHONE_OS_VERSION_MAX_ALLOWED >= __IPHONE_10_0” (MAX_ALLOWED corresponds to the SDK version you link against, in this case the iOS 10.0 SDK).
But in the long run building with Xcode 8 (and the iOS 10.0 or later SDK) will be a given, so I suspect that most solve this problem by branching for that SDK and all the updates that come with it rather than maintaining conditionals like this in their code.
--
David Duncan
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden