小编Noa*_*yer的帖子

UIAlertView在完成处理程序块中不起作用

我正在编写代码以访问用户的Twitter帐户,但是在处理设备上没有帐户的情况时遇到了问题.我想要做的是显示一个警告,告诉,为了与Twitter进行身份验证,他们首先需要在自己的设置来创建的帐户的用户.

这是我的代码:

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 …
Run Code Online (Sandbox Code Playgroud)

objective-c ios

6
推荐指数
1
解决办法
2675
查看次数

标签 统计

ios ×1

objective-c ×1