I'm creating an app that works with CloudKit framework (iOS 8-only) but still want to keep compatibility with iOS 7.1, with no CloudKit functionality, of course. Apple documentation recommends checking for optional classes like this:
if ([CKRecordID class]) {
// iOS 8 code
} else {
// iOS 7 code
}
This works. On the other hand, if I write
@interface Foo : NSObject
@property (nonatomic) CKRecordID *recordID;
@end
anywhere in the code, the app will crash on iOS 7 when loading the Foo
class. How can I define properties with those optional classes?