- (void)requestAuthorizationForAddressBook {
ABAddressBookRef addressBook =ABAddressBookCreateWithOptions(NULL, NULL);
ABAddressBookRequestAccessWithCompletion(addressBook, ^(bool granted, CFErrorRef error) {
if (granted) {
NSLog(@"授权通讯录成功!");
} else {
NSLog(@"授权通讯录失败!"); }
});
CFRelease(addressBook);
}
CFRelease(addressBook);这行会时不时的崩溃掉,因为adressBook�有时是一个僵尸对象。所以应当判断是否为nil,再选择性去释放