我的发布资料不允许我访问iPhone的联系人,我是否需要获得苹果的特别许可?我的开发人员配置文件运行良好,即它可以访问我的手机的联系人,而分发配置文件否认它。它在ios 5模拟器以及iOS 6模拟器中也在模拟器中运行良好。
提前感谢..
__block BOOL accessGranted = NO;
if (ABAddressBookRequestAccessWithCompletion != NULL) { // we're on iOS 6
dispatch_semaphore_t sema = dispatch_semaphore_create(0);
ABAddressBookRequestAccessWithCompletion(addressBook, ^(bool granted, CFErrorRef error) {
NSLog(@"Error ref %@",error);
NSLog(@"Access %i",accessGranted);
accessGranted = granted;
dispatch_semaphore_signal(sema);
});
dispatch_semaphore_wait(sema, DISPATCH_TIME_FOREVER);
dispatch_release(sema);
}
else { // we're on iOS 5 or older
addressBook = ABAddressBookCreate();
accessGranted = YES;
}
if (accessGranted) {
//my code
}