与ACAccountStore的Twitter集成问题(iOS 5)

Meh*_*tri 4 iphone twitter ipad ios5 acaccountstore

当我使用iOS 6.0运行代码时,它的工作正常

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
             }
         });

     }];
Run Code Online (Sandbox Code Playgroud)

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

*** Terminating app due to uncaught exception 'NSInvalidArgumentException', 
reason: '-[ACAccountStore requestAccessToAccountsWithType:options:completion:]: 
unrecognized selector sent to instance 0x68a57c0'
Run Code Online (Sandbox Code Playgroud)

不知道这个奇怪的崩溃日志..

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

yen*_*yen 5

使用以下方法:

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

   if (granted) {

            //Your code
            }
        }
   }];
Run Code Online (Sandbox Code Playgroud)