2
我正在使用iOS5 Twitter API獲得用戶使用其Twitter帳戶的權限。這將彈出一個對話框,用戶可以從中選擇對應用程序授予或拒絕權限。如果用戶接受但是沒有在iPhone上設置Twitter帳戶,我希望能夠打開警報,但由於已經打開對話框,此時打開警報失敗。如何在Twitter權限對話解除後立即添加警報?在iOS5中使用提醒進行Twitter授權對話
- (IBAction)logInToTwitter:(id)sender
{
// First, we need to obtain the account instance for the user's Twitter account
ACAccountStore *store = [[ACAccountStore alloc] init];
ACAccountType *twitterAccountType = [store accountTypeWithAccountTypeIdentifier:ACAccountTypeIdentifierTwitter];
[store requestAccessToAccountsWithType:twitterAccountType
withCompletionHandler:^(BOOL granted, NSError *error) {
if (granted)
{
NSArray *twitterAccounts = [[store accountsWithAccountType:twitterAccountType] autorelease];
if ([twitterAccounts count] > 0)
{
//All good
}
else
{
//Open Alert
}
}
}];
}
什麼叫「在這一點上打開一個警報失敗」意味着什麼。應用程序崩潰了嗎?或者根本沒有警報?如果應用程序沒有崩潰,並且看不到警報,您確定警報不存在嗎? – GnarlyDog 2012-05-29 15:14:14