IOS Objective-c - Getting contacts not working - No request prompt - Access denied










0















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










share|improve this question






















  • 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
















0















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










share|improve this question






















  • 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














0












0








0








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










share|improve this question














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






share|improve this question













share|improve this question











share|improve this question




share|improve this question










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


















  • 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













1 Answer
1






active

oldest

votes


















0














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)






share|improve this answer























  • 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










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
);



);













draft saved

draft discarded


















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









0














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)






share|improve this answer























  • 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















0














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)






share|improve this answer























  • 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













0












0








0







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)






share|improve this answer













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)







share|improve this answer












share|improve this answer



share|improve this answer










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

















  • 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

















draft saved

draft discarded
















































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.




draft saved


draft discarded














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





















































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







Popular posts from this blog

Kleinkühnau

Makov (Slowakei)

Deutsches Schauspielhaus