Вопрос

I'm currently developing an app that uses ACAccountStore to access the twitter account to fetch tweets. Everything works good, but i've no clue what i can display or do if the user doesn't grant promise to the accounts.

My first thought was something about displaying a login view or switch to the iOS settings, but this isn't working in iOS 5.1 or above anymore? Does somebody have another better solution? :)

Best regards

EDIT: I'm not looking for the whole auth-code. Just for the case, where the user doesn't grant access to the account.

Это было полезно?

Решение 2

store = [[ACAccountStore alloc] init];

ACAccountType *twitterType =  [store accountTypeWithAccountTypeIdentifier: ACAccountTypeIdentifierTwitter]; 

// Request Access for Twitter Accounts
[store requestAccessToAccountsWithType:twitterType
  withCompletionHandler:^(BOOL granted, NSError *error){
   if(granted){
    // Handle Granted condition
} else{
    // We didn’t get access, output why not
    NSLog(@”%@”,[error localizedDescription]);
   }
}];

above is a sample authorization requested.

You can get error description in the else part and it is a good idea to show the error description to the user in the alert view or other option is to ask user to allow access for the app through settings app.

You cant switch to the settings app programatically.

Другие советы

when the user doesn't grant you access, simply show an error saying "app was denied access to twitter" and then ignore it -> assume like you don't have twitter

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top