Reputation: 33
I am trying to build an app that fetches contact list from users contacts and renders it in Custom UI of app. I want to support iOS 8 and iOS9 But the problem is methods of AddressBook framework are deprecated in iOS9 and Contacts Framework will not support iOS 8.0. Is there's a way I can support both 8 & 9 for this?
Thanks in Advance!
Upvotes: 3
Views: 3475
Reputation: 23756
Besides checking for iOS 8 and iOS 9 to call functions,
make sure the framework that's not available on iOS 8 is set as Optional
Upvotes: 3
Reputation: 759
You have to implement both the code, if you want to support both iOS versions.
You have to check for iOS versions as below, for Objective-C
NSComparisonResult order = [[UIDevice currentDevice].systemVersion compare: @"9.0" options: NSNumericSearch];
if (order == NSOrderedSame || order == NSOrderedDescending) {
// OS version >= 9.0
// Call contact address book function
} else {
// OS version < 9.0
// Call address book function
}
For swift,
if #available(iOS 9.0, *) {
// OS version >= 9.0
// Call contact address book function
} else {
// OS version < 9.0
// Call address book function
}
Upvotes: 5