因为
ABAuthorizationStatus addressBookStatus = ABAddressBookGetAuthorizationStatus() 这个方法是在ios6之后才添加的,所以在ios5的时候如果要访问用户的通讯录是不做任何提示的,为了适配ios5的系统,在访问用户通讯录的时候提示一个alertView 来解决访问的问题,
if ([[UIDevicecurrentDevice].systemVersion floatValue] < 6.0) {
UIAlertView *alert = [[UIAlertViewalloc] initWithTitle:@"消息提示"
message:@"将访问您的通讯录,是否继续"
delegate:self
cancelButtonTitle:@"取消"
otherButtonTitles:@"继续",nil];
[alert show];
return;
}
用户点击继续,来访问通讯录
不好的地方是每次都需要提示,如果在程序里记录了用户的选择状态,用户又没有地方可以开启设置