ユーザーのTwitterアカウントにアクセスするためのコードを作成していますが、デバイスにアカウントがない場合の処理に問題があります。私がしたいのは、Twitterで認証するためには、最初に自分の設定でアカウントを作成する必要があるという警告を表示することです。完了ハンドラブロックでUIAlertViewが機能しない
ここに私のコードです:
self.accountStore = [[ACAccountStore alloc] init];
ACAccountType *accountTypeTwitter = [self.accountStore accountTypeWithAccountTypeIdentifier:ACAccountTypeIdentifierTwitter];
[self.accountStore requestAccessToAccountsWithType:accountTypeTwitter options:nil completion:^(BOOL granted, NSError *error) {
if(granted) {
//Doesn't matter for the present case
} else if (error){
[SVProgressHUD dismiss]; //not directly relevant to the present question, but it also doesn't work within the block, so I'm leaving it as a clue
switch ([error code]){
case (6):
UIAlertView *alert = [[UIAlertView alloc]initWithTitle:@"No Twitter Account Detected" message:@"Please go into your device's settings menu to add your Twitter account." delegate:nil cancelButtonTitle:@"OK" otherButtonTitles:nil, nil];
[alert show]; //triggers an error
break;
}
}
}];
深い[警告を表示]後約25コールがに、と呼ばれ、私はXcodeのデバッガとは専門家だが、どうやらエラーがACAccountStoreReplyスレッドで発生していますプロセスはucol_getVersionと呼ばれます。デバッガの状態はEXC_BAD_ACCESS(コード= 2、アドレス= 0xcc)です。
私は、ブロック内で動作しないUIAlertViewsに関するソリューションや、アラートを表示する一般的な問題(デリゲートのさまざまな値を試しました)、および一般的な問題requestAccessToAccountsWithTypeへの呼び出し。
また、さまざまなオンラインリソースやObjective-Cのプログラミングの関連ページ、4番目の追加情報を読んで、ブロックの理解に磨きをかけようとしました。
何か助けていただければ幸いです。
絶対に正しい..ブラボ... +1 –
しかし、私はこのalertviewの代理メソッドを呼び出す場合。 ?? –