2013-05-03 116 views
0
[self.ACAstore requestAccessToAccountsWithType:twitterType withCompletionHandler:^(BOOL granted, NSError *error) { 
    self.bPermissionToAccessStoreGranted=granted; 
    [self vContinue]; 
    // Handle any error state here as you wish 
}]; 

授予的結果簡直是錯誤的。我希望用戶先被問到。如何讓IOS要求授予訪問用戶帳戶的權限

可能的原因是iPhone沒有Twitter帳戶。在這種情況下,我想顯示一個twitter登錄頁面,以便用戶註冊。

+0

你想在執行上面的代碼之前詢問用戶是否允許這個嗎?像一些彈出(警報)? – gasparuff 2013-05-03 07:25:24

+0

我這麼認爲,但我認爲這是iOS會做的事情。 – 2013-05-03 07:42:12

+0

好吧,我的意思是創建Alert來詢問用戶並不難,但是如果'granted'總是返回false,那麼似乎還有其他一些問題。我還沒有嘗試使用Twitter的任何身份驗證,所以我無法幫助你。我只能幫你設置警報。 – gasparuff 2013-05-03 07:51:47

回答

2
[self.ACAstore requestAccessToAccountsWithType:twitterType withCompletionHandler:^(BOOL granted, NSError *error) { 
if(granted) 
{ 
    [self vContinue]; 
} 
else { 
    // Handle any error state here as you wish 
} 
}]; 

你想要這個嗎?

+0

我做到了。相反,iOS只是默默拒絕請求。 – 2013-05-03 07:41:04

+0

有沒有符合twitterType的帳戶? – 2013-05-03 07:45:19