gpt4 book ai didi

objective-c - 未调用 requestAccessToAccountsWithType 完成

转载 作者:搜寻专家 更新时间:2023-10-30 20:05:46 25 4
gpt4 key购买 nike

当我运行 [_accountStore requestAccessToAccountsWithType: ...] 时,我没有收到任何响应。我的完成处理程序没有被调用。但是我确实可以访问 Twitter。

    //  Step 0: Check that the user has local Twitter accounts
if ([SLComposeViewController
isAvailableForServiceType:SLServiceTypeTwitter]) {
NSLog(@"OH YES!!!");
// Step 1: Obtain access to the user's Twitter accounts
ACAccountType *twitterAccountType = [_accountStore accountTypeWithAccountTypeIdentifier: ACAccountTypeIdentifierTwitter];
NSLog(@"OH YES!!!");

[_accountStore requestAccessToAccountsWithType:twitterAccountType options:nil
completion:^(BOOL granted, NSError *error)
{
NSLog(@"Im in!");
if (granted == YES)
{
NSArray *arrayOfAccounts = [_accountStore
accountsWithAccountType:twitterAccountType];

if ([arrayOfAccounts count] > 0)
{
ACAccount *twitterAccount = [arrayOfAccounts lastObject];

NSLog(@"%@", twitterAccount.userFullName);
NSLog(@"%@", twitterAccount.username);
NSLog(@"%@", twitterAccount.credential);
NSLog(@"%@", twitterAccount.identifier);

}
}else{
NSLog(@"Failed muahahaha");
}
}];
}

为什么会这样?

最佳答案

例如使用 shure _accountStore 进行初始化

_accountStore = [[ACAccountStore alloc] init];

关于objective-c - 未调用 requestAccessToAccountsWithType 完成,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19869442/

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