我之前看过一个像这样的问题,但答案是不需要许可,因为没有编辑......但是没有回答用户提示未显示的问题。
我的问题是我确实需要编辑所以确实需要此提示,以便用户可以授予权限。目前,我没有收到提示,因此始终是访问,"拒绝"。
我的片段在下面。 (Xcode 7.2.1 iOS 9.2.1) 任何帮助,提示将不胜感激。 我没有看到任何其他人有这个问题,所以不知道问题是什么...我尝试了弃用的AB方法以及相同的NO提示权限...是否有一些需要的plist字符串像位置经理一样设置??? 谢谢......
func checkContactsAccess() {
switch CNContactStore.authorizationStatusForEntityType(.Contacts) {
// Update our UI if the user has granted access to their Contacts
case .Authorized:
print("Access Granted")
// Prompt the user for access to Contacts if there is no definitive answer
case .NotDetermined :
self.requestContactsAccess()
// Display a message if the user has denied or restricted access to Contacts
case .Denied,
.Restricted:
let alert = UIAlertController(title: "Privacy Warning!",
message: "Permission was not granted for Contacts.",
preferredStyle: .Alert)
alert.addAction(UIAlertAction(title: "OK", style: .Default, handler: nil))
self.presentViewController(alert, animated: true, completion: nil)
}
}
func requestContactsAccess() {
contactStore.requestAccessForEntityType(.Contacts) {granted, error in
if granted {
dispatch_async(dispatch_get_main_queue()) {
print("Access Granted")
return
}
}
}
}
答案 0 :(得分:0)
是否需要像位置管理器那样设置一些plist字符串
是的,当然有。名称完全平行:“隐私 - 联系人使用说明”。
答案 1 :(得分:0)
使用联系人选择器视图的应用不需要访问用户的联系人,并且不会提示用户“授予许可”访问权限。该应用只能访问用户的最终选择。