songkailei / idoubs

Automatically exported from code.google.com/p/idoubs
0 stars 0 forks source link

Not support iOS6? ‘ABAddressBookCreate’ is deprecated in iOS6 #158

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
In iOS 6, the system now protects Calendars, Reminders, Contacts, and Photos as 
part of Apple’s data isolation privacy initiative.Users will see access 
dialogs when an app tries to access any of those data types. No privacy alerts 
are displayed in iOS Simulator.

What version of the product or source code revision are you using? On what
operating system?
Mac 10.8.4,Xcode 4.6.3, iOS SDK 6.1

Please provide any additional information below.

in file 'NgnContactService.mm' , 
"addressBook = ABAddressBookCreate();" replaced by below:

if ([[UIDevice currentDevice].systemVersion floatValue] >= 6.0){
            addressBook = ABAddressBookCreateWithOptions(NULL, NULL);
            dispatch_semaphore_t sema = dispatch_semaphore_create(0);
            ABAddressBookRequestAccessWithCompletion(addressBook, 
            ^(bool granted, CFErrorRef error){
                  dispatch_semaphore_signal(sema);
            });

            dispatch_semaphore_wait(sema, DISPATCH_TIME_FOREVER);
            dispatch_release(sema);
}
else{
            addressBook = ABAddressBookCreate();
}

Original issue reported on code.google.com by zwen0206 on 11 Jul 2013 at 9:06

GoogleCodeExporter commented 9 years ago
Thanks for your report.
Fixed in r245: 
https://code.google.com/p/idoubs/source/diff?spec=svn245&r=245&format=side&path=
/branches/2.0/common-ngn-stack/services/impl/NgnContactService.mm

Original comment by boss...@yahoo.fr on 11 Jul 2013 at 7:03

GoogleCodeExporter commented 9 years ago
Hey thanks alot, its working... :)

Original comment by yasodha....@gmail.com on 15 Feb 2014 at 5:00