【发布时间】:2013-10-26 08:50:43
【问题描述】:
每当用户在地址簿权限UIAlertView 上按下OK 时,一切正常,除了执行这些命令的延迟,奇怪的是,这些命令需要大约 5 秒才能执行,即使打印了NSLog瞬间。
相同的代码在日历权限中立即生效。
有人可以帮我吗?谢谢你。
延迟(5秒)后正在执行的代码
NSLog(@"Granted!");_1234.backgroundColor = [UIColor lightGrayColor]; [_12345 setHidden:NO]; [ _qwerty setTitleColor:[UIColor lightGrayColor] forState:UIControlStateNormal]; [_qwerty1 setHidden:YES];
功能齐全
ABAAddressBookRef addressBookRef = ABAddressBookCreateWithOptions(NULL, NULL);
如果 (ABAAddressBookGetAuthorizationStatus() == kABAuthorizationStatusNotDetermined) {
ABAddressBookRequestAccessWithCompletion(addressBookRef, ^(bool 授予,CFErrorRef 错误){
如果(错误)
{ // display error message here }else if (!granted)
{ // display access denied error message here } else { NSLog(@"Granted!"); //this gets printed instantly _qwerty.userInteractionEnabled = NO; _1234.backgroundColor = [UIColor lightGrayColor]; [_12345 setHidden:NO]; [ _qwerty setTitleColor:[UIColor lightGrayColor] forState:UIControlStateNormal]; [_qwerty1 setHidden:YES]; [self qwerty4]; } }); }
【问题讨论】:
标签: ios objective-c ios7 abaddressbook