我正在使用以下代码从用户电话中获取联系人
CFErrorRef error;
__block BOOL accessGranted;
ABAddressBookRef myAddressBook = ABAddressBookCreateWithOptions(NULL,&error);
ABAddressBookRequestAccessWithCompletion(myAddressBook, ^(bool granted, CFErrorRef error)
{
if (!accessGranted && !granted)
{
alertViewDeny = [[UIAlertView alloc]initWithTitle:@"Deny Access" message:@"Deny" delegate:self cancelButtonTitle:nil otherButtonTitles:@"cancel", nil];
[alertViewDeny show];
[alertViewDeny release];
}
else
{
NSArray *allPeople = (NSArray *)ABAddressBookCopyArrayOfAllPeople(myAddressBook);
DLog(@"allPeople %@",allPeople);
}
在输出中我得到 //Only for iOS7 并且它在 iOS6 中工作。
所有人( )