Acess user twitter account IOS

447 Views Asked by At

I'm using the code below to access the user's twitter account. The UIAlert only ever pops up once on any given device. It seems that this is a one-time access request, and once granted or denied, you have to go into 'Settings' to change it.

Obviously, as a developer, this is useless. I need to re-create the situation whereby the question is asked for the first time, and cause the UIAlert which says, "Don't Allow / Allow" to re-appear.

Deleting the app and all data, and re-compiling anew from XCode does not work. It seems this permission/denial is stored somewhere that I do not know about [keychain?]. How can I restore everything such that the device thinks this permission has never been granted/denied before, WITHOUT having to go into 'Settings'?

ACAccountStore *accountStore = [[ACAccountStore alloc] init];
ACAccountType *accountType = [accountStore accountTypeWithAccountTypeIdentifier:ACAccountTypeIdentifierTwitter];

[accountStore requestAccessToAccountsWithType:accountType options:nil completion: ^ (BOOL granted, NSError *error) {
    if(granted == YES){

        // granted code goes here

    } else {

        // not granted code goes here
    }


}];
2

There are 2 best solutions below

0
Binary Pulsar On

You can't reset this without going into settings or changing the bundle ID of the app. Since the former is more sensible:

Go to: Settings -> General -> Reset -> Reset Location & Privacy.

This will cause the app to ask for permissions again.

0
Singam madhukar On

Simply Go to the settings of your mobile or simulator then General>Reset>Reset Location & Privacy... This will ask for permission again

then back to the settings ... below you will see twitter click on it then check twitter account logged in or not, if not login with your twitter credentials ..then below of the screen u can see Allow these Apps to use your account... if the integration process had done correctly .. you will see your app(Project name) set it on if it is off..

thats it Go to your xcode project and run it again...

thumpsUp..!!