0

I've seen one question like this one prior, but the answer was that permission was not needed because there was no editing... however the question as to why a user prompt was not being shown was not answered.
My issue is that I do need to edit so really do need this prompt so the user can give permission. Currently, I do not get prompted so access is always, "denied".

My snippets are below. (Xcode 7.2.1 iOS 9.2.1) Any help, tips would be appreciated. I do not see any others with this issue so don't know what the issue is... I tried the deprecated AB method as well with the same NO prompt for permissions... Is there some plist string that needs to be set like for location manager???
Thanks...

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
            }
        }
    }
}
4

2 に答える 2

0

連絡先ピッカー ビューを使用するアプリは、ユーザーの連絡先へのアクセスを必要とせず、ユーザーは "権限を付与する" アクセスを求められません。アプリは、ユーザーの最終選択にのみアクセスできます。

CNContactPickerViewController

于 2020-08-05T01:10:18.130 に答える
-1

ロケーションマネージャーのように設定する必要があるplist文字列はありますか

はい、もちろんあります。そして、その名前は完全に類似しています: 「プライバシー — 連絡先の使用方法の説明」。

于 2016-03-18T17:58:07.890 に答える