IOS Objective-c - Getting contacts not working - No request prompt - Access denied
I am using Objective-c to develop an app for iPad. I need to fetch the address book for the contacts. But I get no access request prompt and the access stays denied. The boolean "granted" is never true and the code to get the contacts array is never reached. Therefore the contacts array contactsArray stays empty.
Following is the code I am using:
-(void) fetchAllContacts
contactsArray = [[NSMutableArray alloc] init];
CNContactStore *store = [[CNContactStore alloc] init];
[store requestAccessForEntityType : CNEntityTypeContacts completionHandler : ^(BOOL granted, NSError * _Nullable error)
if (granted)
// Code to get the contacts array
// contactsArray = ....
];
Any help?
Thank you
ios objective-c contacts access addressbook
|
show 3 more comments
I am using Objective-c to develop an app for iPad. I need to fetch the address book for the contacts. But I get no access request prompt and the access stays denied. The boolean "granted" is never true and the code to get the contacts array is never reached. Therefore the contacts array contactsArray stays empty.
Following is the code I am using:
-(void) fetchAllContacts
contactsArray = [[NSMutableArray alloc] init];
CNContactStore *store = [[CNContactStore alloc] init];
[store requestAccessForEntityType : CNEntityTypeContacts completionHandler : ^(BOOL granted, NSError * _Nullable error)
if (granted)
// Code to get the contacts array
// contactsArray = ....
];
Any help?
Thank you
ios objective-c contacts access addressbook
Have a look at stackoverflow.com/questions/47019095/…. It might help you.
– Sateesh
Nov 13 '18 at 9:56
At first your Info.plist file must include string value NSContactsUsageDescription (see Apple docs).
– Eridana
Nov 13 '18 at 9:58
If you have already denied the permission iOS don't ask it again. You have to change it in the Settings app in the section of your app.
– lorenzoliveto
Nov 13 '18 at 10:05
Thank you guys for your comments. @Eridana; a string value is added in NSContactsUsageDescription in my app. @ lorenzoliveto; My app is not visible in the Settings, actually the list is empty.
– Brian Scherady
Nov 13 '18 at 10:32
Hmm.. if you are using simulator, try to reset it and reinstall the app. Sometimes it really helps
– Eridana
Nov 13 '18 at 10:56
|
show 3 more comments
I am using Objective-c to develop an app for iPad. I need to fetch the address book for the contacts. But I get no access request prompt and the access stays denied. The boolean "granted" is never true and the code to get the contacts array is never reached. Therefore the contacts array contactsArray stays empty.
Following is the code I am using:
-(void) fetchAllContacts
contactsArray = [[NSMutableArray alloc] init];
CNContactStore *store = [[CNContactStore alloc] init];
[store requestAccessForEntityType : CNEntityTypeContacts completionHandler : ^(BOOL granted, NSError * _Nullable error)
if (granted)
// Code to get the contacts array
// contactsArray = ....
];
Any help?
Thank you
ios objective-c contacts access addressbook
I am using Objective-c to develop an app for iPad. I need to fetch the address book for the contacts. But I get no access request prompt and the access stays denied. The boolean "granted" is never true and the code to get the contacts array is never reached. Therefore the contacts array contactsArray stays empty.
Following is the code I am using:
-(void) fetchAllContacts
contactsArray = [[NSMutableArray alloc] init];
CNContactStore *store = [[CNContactStore alloc] init];
[store requestAccessForEntityType : CNEntityTypeContacts completionHandler : ^(BOOL granted, NSError * _Nullable error)
if (granted)
// Code to get the contacts array
// contactsArray = ....
];
Any help?
Thank you
ios objective-c contacts access addressbook
ios objective-c contacts access addressbook
asked Nov 13 '18 at 9:52
Brian ScheradyBrian Scherady
1616
1616
Have a look at stackoverflow.com/questions/47019095/…. It might help you.
– Sateesh
Nov 13 '18 at 9:56
At first your Info.plist file must include string value NSContactsUsageDescription (see Apple docs).
– Eridana
Nov 13 '18 at 9:58
If you have already denied the permission iOS don't ask it again. You have to change it in the Settings app in the section of your app.
– lorenzoliveto
Nov 13 '18 at 10:05
Thank you guys for your comments. @Eridana; a string value is added in NSContactsUsageDescription in my app. @ lorenzoliveto; My app is not visible in the Settings, actually the list is empty.
– Brian Scherady
Nov 13 '18 at 10:32
Hmm.. if you are using simulator, try to reset it and reinstall the app. Sometimes it really helps
– Eridana
Nov 13 '18 at 10:56
|
show 3 more comments
Have a look at stackoverflow.com/questions/47019095/…. It might help you.
– Sateesh
Nov 13 '18 at 9:56
At first your Info.plist file must include string value NSContactsUsageDescription (see Apple docs).
– Eridana
Nov 13 '18 at 9:58
If you have already denied the permission iOS don't ask it again. You have to change it in the Settings app in the section of your app.
– lorenzoliveto
Nov 13 '18 at 10:05
Thank you guys for your comments. @Eridana; a string value is added in NSContactsUsageDescription in my app. @ lorenzoliveto; My app is not visible in the Settings, actually the list is empty.
– Brian Scherady
Nov 13 '18 at 10:32
Hmm.. if you are using simulator, try to reset it and reinstall the app. Sometimes it really helps
– Eridana
Nov 13 '18 at 10:56
Have a look at stackoverflow.com/questions/47019095/…. It might help you.
– Sateesh
Nov 13 '18 at 9:56
Have a look at stackoverflow.com/questions/47019095/…. It might help you.
– Sateesh
Nov 13 '18 at 9:56
At first your Info.plist file must include string value NSContactsUsageDescription (see Apple docs).
– Eridana
Nov 13 '18 at 9:58
At first your Info.plist file must include string value NSContactsUsageDescription (see Apple docs).
– Eridana
Nov 13 '18 at 9:58
If you have already denied the permission iOS don't ask it again. You have to change it in the Settings app in the section of your app.
– lorenzoliveto
Nov 13 '18 at 10:05
If you have already denied the permission iOS don't ask it again. You have to change it in the Settings app in the section of your app.
– lorenzoliveto
Nov 13 '18 at 10:05
Thank you guys for your comments. @Eridana; a string value is added in NSContactsUsageDescription in my app. @ lorenzoliveto; My app is not visible in the Settings, actually the list is empty.
– Brian Scherady
Nov 13 '18 at 10:32
Thank you guys for your comments. @Eridana; a string value is added in NSContactsUsageDescription in my app. @ lorenzoliveto; My app is not visible in the Settings, actually the list is empty.
– Brian Scherady
Nov 13 '18 at 10:32
Hmm.. if you are using simulator, try to reset it and reinstall the app. Sometimes it really helps
– Eridana
Nov 13 '18 at 10:56
Hmm.. if you are using simulator, try to reset it and reinstall the app. Sometimes it really helps
– Eridana
Nov 13 '18 at 10:56
|
show 3 more comments
1 Answer
1
active
oldest
votes
iOS will only present the modal access request prompt once. If you have denied the access the first time, the app will be unable to access it until the user changes the app's permissions in the iOS settings.
One option is to present a custom prompt saying access is denied with a button to navigate directly to the app settings page, using UIApplicationOpenSettingsURLString as an URL.
//objc
NSURL * url = [[NSURL alloc] initWithString:UIApplicationOpenSettingsURLString];
[UIApplication.sharedApplication openURL:url];
//swift
if let url = URL(string: UIApplicationOpenSettingsURLString)
UIApplication.shared.openURL(url)
On my iPad in Settings -> Privacy -> Contacts under "Applications that have requested access to your contacts will appear here." there is nothing; no application is listed. Also I have never seen the prompt for request for access to the contacts. Furthermore, I deleted the app and restarted the iPad; it didn't help :(
– Brian Scherady
Nov 13 '18 at 15:13
add a comment |
Your Answer
StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53278239%2fios-objective-c-getting-contacts-not-working-no-request-prompt-access-deni%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
iOS will only present the modal access request prompt once. If you have denied the access the first time, the app will be unable to access it until the user changes the app's permissions in the iOS settings.
One option is to present a custom prompt saying access is denied with a button to navigate directly to the app settings page, using UIApplicationOpenSettingsURLString as an URL.
//objc
NSURL * url = [[NSURL alloc] initWithString:UIApplicationOpenSettingsURLString];
[UIApplication.sharedApplication openURL:url];
//swift
if let url = URL(string: UIApplicationOpenSettingsURLString)
UIApplication.shared.openURL(url)
On my iPad in Settings -> Privacy -> Contacts under "Applications that have requested access to your contacts will appear here." there is nothing; no application is listed. Also I have never seen the prompt for request for access to the contacts. Furthermore, I deleted the app and restarted the iPad; it didn't help :(
– Brian Scherady
Nov 13 '18 at 15:13
add a comment |
iOS will only present the modal access request prompt once. If you have denied the access the first time, the app will be unable to access it until the user changes the app's permissions in the iOS settings.
One option is to present a custom prompt saying access is denied with a button to navigate directly to the app settings page, using UIApplicationOpenSettingsURLString as an URL.
//objc
NSURL * url = [[NSURL alloc] initWithString:UIApplicationOpenSettingsURLString];
[UIApplication.sharedApplication openURL:url];
//swift
if let url = URL(string: UIApplicationOpenSettingsURLString)
UIApplication.shared.openURL(url)
On my iPad in Settings -> Privacy -> Contacts under "Applications that have requested access to your contacts will appear here." there is nothing; no application is listed. Also I have never seen the prompt for request for access to the contacts. Furthermore, I deleted the app and restarted the iPad; it didn't help :(
– Brian Scherady
Nov 13 '18 at 15:13
add a comment |
iOS will only present the modal access request prompt once. If you have denied the access the first time, the app will be unable to access it until the user changes the app's permissions in the iOS settings.
One option is to present a custom prompt saying access is denied with a button to navigate directly to the app settings page, using UIApplicationOpenSettingsURLString as an URL.
//objc
NSURL * url = [[NSURL alloc] initWithString:UIApplicationOpenSettingsURLString];
[UIApplication.sharedApplication openURL:url];
//swift
if let url = URL(string: UIApplicationOpenSettingsURLString)
UIApplication.shared.openURL(url)
iOS will only present the modal access request prompt once. If you have denied the access the first time, the app will be unable to access it until the user changes the app's permissions in the iOS settings.
One option is to present a custom prompt saying access is denied with a button to navigate directly to the app settings page, using UIApplicationOpenSettingsURLString as an URL.
//objc
NSURL * url = [[NSURL alloc] initWithString:UIApplicationOpenSettingsURLString];
[UIApplication.sharedApplication openURL:url];
//swift
if let url = URL(string: UIApplicationOpenSettingsURLString)
UIApplication.shared.openURL(url)
answered Nov 13 '18 at 10:31
Pedro Henrique Lenzi SoaresPedro Henrique Lenzi Soares
1
1
On my iPad in Settings -> Privacy -> Contacts under "Applications that have requested access to your contacts will appear here." there is nothing; no application is listed. Also I have never seen the prompt for request for access to the contacts. Furthermore, I deleted the app and restarted the iPad; it didn't help :(
– Brian Scherady
Nov 13 '18 at 15:13
add a comment |
On my iPad in Settings -> Privacy -> Contacts under "Applications that have requested access to your contacts will appear here." there is nothing; no application is listed. Also I have never seen the prompt for request for access to the contacts. Furthermore, I deleted the app and restarted the iPad; it didn't help :(
– Brian Scherady
Nov 13 '18 at 15:13
On my iPad in Settings -> Privacy -> Contacts under "Applications that have requested access to your contacts will appear here." there is nothing; no application is listed. Also I have never seen the prompt for request for access to the contacts. Furthermore, I deleted the app and restarted the iPad; it didn't help :(
– Brian Scherady
Nov 13 '18 at 15:13
On my iPad in Settings -> Privacy -> Contacts under "Applications that have requested access to your contacts will appear here." there is nothing; no application is listed. Also I have never seen the prompt for request for access to the contacts. Furthermore, I deleted the app and restarted the iPad; it didn't help :(
– Brian Scherady
Nov 13 '18 at 15:13
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53278239%2fios-objective-c-getting-contacts-not-working-no-request-prompt-access-deni%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Have a look at stackoverflow.com/questions/47019095/…. It might help you.
– Sateesh
Nov 13 '18 at 9:56
At first your Info.plist file must include string value NSContactsUsageDescription (see Apple docs).
– Eridana
Nov 13 '18 at 9:58
If you have already denied the permission iOS don't ask it again. You have to change it in the Settings app in the section of your app.
– lorenzoliveto
Nov 13 '18 at 10:05
Thank you guys for your comments. @Eridana; a string value is added in NSContactsUsageDescription in my app. @ lorenzoliveto; My app is not visible in the Settings, actually the list is empty.
– Brian Scherady
Nov 13 '18 at 10:32
Hmm.. if you are using simulator, try to reset it and reinstall the app. Sometimes it really helps
– Eridana
Nov 13 '18 at 10:56