gpt4 book ai didi

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

转载 作者:行者123 更新时间:2023-12-03 19:07:44 31 4
gpt4 key购买 nike

当我使用 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
}
});

}];

当我在 iOS 5.0 或 5.1 上运行此代码时,它崩溃并显示以下输出,

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

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

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

最佳答案

使用以下方法:

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

if (granted) {

//Your code
}
}
}];

关于iphone - Twitter 与 ACAccountStore 的集成问题 (iOS 5),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15244861/

31 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com