与ACAccountStore的Twitter集成问题(iOS 5) [英] Twitter integration issue with ACAccountStore (iOS 5)

查看:178
本文介绍了与ACAccountStore的Twitter集成问题(iOS 5)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我在iOS 6.0下运行代码时,其工作

When I run below code with iOS 6.0, Its working

ACAccountStore *account = [[ACAccountStore alloc] init];
ACAccountType *accountType = [account accountTypeWithAccountTypeIdentifier:ACAccountTypeIdentifierTwitter];

[account requestAccessToAccountsWithType:accountType options:nil
                                  completion:^(BOOL granted, NSError *error)
     {
         dispatch_async(dispatch_get_main_queue(), ^{

             if (granted) 
             {
                 //MY CODE
             }
         });

     }];

当我用iOS 5.0或5.1运行此代码时,它崩溃了以下输出,

and When I run this code with iOS 5.0 or 5.1, It crashes with following output,

*** Terminating app due to uncaught exception 'NSInvalidArgumentException', 
reason: '-[ACAccountStore requestAccessToAccountsWithType:options:completion:]: 
unrecognized selector sent to instance 0x68a57c0'

不知道这个奇怪的崩溃记录..

Don't know about this weird crash log..

请告诉我,如何摆脱这个..

Please tell me, How to get rid of this..

推荐答案

使用以下方法:

[account requestAccessToAccountsWithType:accountType withCompletionHandler:^(BOOL granted, NSError *error)
 {

   if (granted) {

            //Your code
            }
        }
   }];

这篇关于与ACAccountStore的Twitter集成问题(iOS 5)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆