0

I want to programatically fetch the value of "Allow these Apps to use your account" in Twitter Settings Page and if it is disabled open the Settings Page so the user can manually change the value.

I have tried to open settings page in Twitter in iOS 8.1 using the code :

[[UIApplication sharedApplication] openURL:[NSURL URLWithString:@”prefs:root=TWITTER”]];

But it does nothing in iOS 8+.Does anyone know how to fetch this value programatically and redirect to Settings Page of twitter ?

enter image description here

Utsav Parikh
  • 1,216
  • 7
  • 14

2 Answers2

1

prefs scheme does not work anymore, all your app can do now is open an app preferences via UIApplicationOpenSettingsURLString constant. see this answer.

Note also, that requestAccessToAccountsWithType:options:completion: method will trigger a permission dialog if this is a first call. So the better way will be to fail gracefully, when you try to do something with twitter. The permissions dialog should be a result of user action, so it will not be confusing for him.

Community
  • 1
  • 1
Sega-Zero
  • 3,034
  • 2
  • 22
  • 46
0

Try Following...

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

[account requestAccessToAccountsWithType:accountType options:nil
                              completion:^(BOOL granted, NSError *error)
 {
     if (granted == YES)
     {
         NSLog(@"Twitter Access");
     }
     else
     {
         NSLog(@"No Twitter Access");
     }
 }];
Nirav Gadhiya
  • 6,342
  • 2
  • 37
  • 76