这个附加功能尝试访问用户在 Settings.app 中定义的 Twitter 账户。如果用户有多个账户,将显示一个 UIActionSheet
,用户可以选择其中一个账户;如果没有定义任何账户,将在完成块中返回定义的账户。
您只需调用以下方法
@interface UIViewController (TwitterAccess)
- (void)authorizeTwitterAccount:(TRTwitterAuthorizationFinishedBlock)finishedBlock;
@end
如果用户在 Settings.app 中没有任何 Twitter 账户,我们返回 GKTwitterAccessErrorCodeNoTwitterAccounts
作为错误。
如果用户在显示 UIActionSheet
时点击取消,我们返回 GKTwitterAccessErrorCodeUserCancelledActionSheet
作为错误。
最后,如果在授权过程中发生任何其他错误,我们将返回从框架获取的错误。
没有 Twitter 账户 -> 错误 一个或多个 Twitter 账户 -> 访问 denied -> 错误 一个 Twitter 账户 -> 访问 granted -> 返回账户 更多 Twitter 账户 -> 访问 granted -> 显示 UIActionSheet -> 返回选择的账户
Georg Kitz, @gekitz