rokridi
rokridi

Reputation: 1675

Compile errors for different XCode versions

I am developing an application that should run on iOS versions >= 7.0 . I am currently testing my app using simulators. I find it very annoying to comment my code once i am switching to XCode 5 in order to test my application on iOS 7. Is there any clean straight method that spares all the headache ? Is there any useful macro that allows to specify when to compile code and when not to ?

Upvotes: 1

Views: 71

Answers (2)

Jeremy Huddleston Sequoia
Jeremy Huddleston Sequoia

Reputation: 23623

If you plan on compiling the same code against older SDK versions that lack newer features that you are using, you should use the __IPHONE_OS_VERSION_MAX_ALLOWED macro from Availability.h. Look at the header's comments for documentation, but the short of it is:

#if __IPHONE_OS_VERSION_MAX_ALLOWED < 80000
    // Do fallback path that does not depend on iOS features
#elif __IPHONE_OS_VERSION_MIN_REQUIRED < 8000
    if (check for availability of new feature at runtime)
        // Use new feature
    else 
        // Do fallback path that does not depend on iOS features
#else
    // Use new feature unconditionally
#endif

You can also download the iOS 7.1 simulator runtime from within Xcode 6 and run your apps against it (assuming the deployment target is set back to 7.1 or older).

Upvotes: 0

miletliyusuf
miletliyusuf

Reputation: 1022

Don't you have iOS 7.1 simulator in Downloads(Xcode>Preferences>Downloads)?

Upvotes: 2

Related Questions