gpt4 book ai didi

iOS requestAccessToAccountsWithType 不显示权限提示/NSAlert

转载 作者:可可西里 更新时间:2023-11-01 05:36:26 25 4
gpt4 key购买 nike

据我了解,当我调用 [ACAccountStore requestAccessToAccountsWithType:options:completion] 时,用户应该会看到一个 UIAlert,询问他们是否授予我的应用程序权限。

当我运行这段代码时,从来没有提示,granted 变量始终为“false”

-(void)myfunction { 
if (!_accountStore) _accountStore = [[ACAccountStore alloc] init];

ACAccountType *fbActType = [_accountStore accountTypeWithAccountTypeIdentifier:ACAccountTypeIdentifierFacebook];


NSDictionary *options = [[NSDictionary alloc] initWithObjectsAndKeys:
(NSString *)ACFacebookAppIdKey, @"##########",
(NSString *)ACFacebookPermissionsKey, [NSArray arrayWithObject:@"email"],
nil];


[_accountStore requestAccessToAccountsWithType:fbActType options:options completion:^(BOOL granted, NSError *error) {
NSLog(@"Home.m - getFBDetails - Check 2");
if (granted == YES) {
NSLog(@"Success");
NSArray *accounts = [_accountStore accountsWithAccountType:fbActType];
_facebookAccount = [accounts lastObject];
[self me];
} else {
NSLog(@"ERR: %@ ",error);
// Fail gracefully...
}
}
];

}

我收到错误:ERR: Error Domain=com.apple.accounts Code=8 "The operation couldn't be completed. (com.apple.accounts error 8.)"

更新:我做了一些测试,如果我使用 ACAccountTypeIdentifierTwitter 运行,我会收到连接到我的 Twitter 帐户的提示,所以我假设它与我的 Facebook 设置 ...

最佳答案

您的选项字典中有倒置的对象和键:

NSDictionary *options = [[NSDictionary alloc] initWithObjectsAndKeys:
@"##########", ACFacebookAppIdKey,
[NSArray arrayWithObject:@"email"], ACFacebookPermissionsKey,
nil];

关于iOS requestAccessToAccountsWithType 不显示权限提示/NSAlert,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16469077/

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