iphone - Programmatically changing privacy settings on iOS -


over past day have been trying finalize view controller accesses contacts in user's address book. have been signing various apps , going through signup flows ask access address book.

there 2 different ways these apps handle address book access:

  1. the app wants access contacts, show uialertview window says this: "we need access address book. can enable going settings > privacy > contacts > turn on app name.

  2. the app wants access contacts, show uialertview window says this: "we need access contacts can find friends"

what's different though option 2 in uialertview window, have 2 buttons "don't allow" , "ok".

i under impression if press "ok" allow access contacts, , if press "don't allow" block app accessing contacts.

however, if press "ok" in these apps, doesn't change privacy settings. pressing "don't allow" doesn't change either.

so, these apps choosing show "ok" , "don't allow" whatever reason, despite fact don't work or have functionality @ all? assumed there way programmatically change privacy settings, , pressing "ok" button method being called did something.

i using ios 7.0.4 on iphone 4s , started developing ios have experience ios 7.

i don't understand what's possible , why experiencing behavior above.

if clear me appreciate it.

the first 1 not change thing because instruction tells how enable related privacy settings in settings app. have go settings app , navigate right view , change privacy setting yourself

it possible access users' contacts on ios devices. , not have make customized message tell users why need permission. apple prompt user system alertview. think second 1 supposed bring system alertview when pressed "ok".

you have put following code before accessing users' contacts. somewhere in applicationdidfinishlaunching should good.

abaddressbookref addressbookref = abaddressbookcreatewithoptions(null, null);    if (abaddressbookgetauthorizationstatus() == kabauthorizationstatusnotdetermined) {     abaddressbookrequestaccesswithcompletion(addressbookref, ^(bool granted, cferrorref error) {       if (granted) {           // access has been granted.       } else {           // user denied access       }     });   }   else if (abaddressbookgetauthorizationstatus() == kabauthorizationstatusauthorized) {     // user has given access   }   else {     // user has denied access    } 

Comments

Popular posts from this blog

php - SPIP: From Tag directly to an article -

jquery - isAjaxRequest always return false -

ruby on rails - In a controller spec, how to find a specific tag in the generated view? -