Tony
Tony

Reputation: 664

Prevent classes from compiling on specific iOS version

I have a class that is using NSURLSession and I still need to support iOS 6. When I try to compile targeting iOS 6, it fails, since NSURLSession doesn't exist.

How do i disable this class from compiling for iOS 6?

Upvotes: 1

Views: 241

Answers (1)

rakmoh
rakmoh

Reputation: 2963

If you need to support both iOS 7 and iOS 6.x then your base sdk should be iOS7 and iOS Deployment target should be iOS 6.0.

You should be modifying your class so that your application supports both iOS 7 and iOS 6.x

if ([NSURLSession class]) {
    // Use NSURLSession
}
else {
    // Start background task, iOS 6 way
}

Upvotes: 1

Related Questions