1

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.

4

2 に答える 2

2

ユーザーがあなたにアクセスを許可しない場合は、「アプリはTwitterへのアクセスを拒否されました」というエラーを表示し、それを無視します->Twitterを持っていないように想定します

于 2013-03-03T10:50:54.703 に答える
0
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]);
   }
}];

上記は、リクエストされた承認のサンプルです。

Else 部分でエラーの説明を取得できます。アラート ビューでユーザーにエラーの説明を表示することをお勧めします。または、設定アプリからアプリへのアクセスを許可するようユーザーに依頼することもできます。

プログラムで設定アプリに切り替えることはできません。

于 2013-03-03T09:04:45.843 に答える