gpt4 book ai didi

ios - FBSDKLog 缺少权限

转载 作者:可可西里 更新时间:2023-11-01 05:40:20 29 4
gpt4 key购买 nike

我想与 facebook 分享新闻。这是代码:

RACSignal *sign = [RACSignal createSignal:^RACDisposable *(id<RACSubscriber> subscriber) {
if([[FBSDKAccessToken currentAccessToken] hasGranted:@"publish_actions"]){
NSLog(@"1 blck");
NSLog(@"curr tok? %@", [FBSDKAccessToken currentAccessToken]);
[subscriber sendNext:@YES];
[subscriber sendCompleted];
} else {
NSLog(@"2 blck");
FBSDKLoginManager *login = [[FBSDKLoginManager alloc] init];
[login logOut];
login.loginBehavior = FBSDKLoginBehaviorWeb;
[login logInWithPublishPermissions:@[@"publish_actions"] fromViewController:APP.window.rootViewController handler:^(FBSDKLoginManagerLoginResult *result, NSError *error) {
NSLog(@"log passed by");
self.isExecuting = YES;
if (error) {
NSError *err = [NSError errorWithDomain:@"ru.myServer.fb" code:-3 userInfo:@{NSLocalizedDescriptionKey:error.localizedDescription}];
[subscriber sendError:err];
} else if (result.isCancelled) {
NSError *err = [NSError errorWithDomain:@"ru.myServer.fb" code:-4 userInfo:@{NSLocalizedDescriptionKey:@"Недоступно"}];
[subscriber sendError:err];
} else {
NSString *strToken = result.token.tokenString;
NSString *strUserId = result.token.userID;
NSDictionary *dctProps = @{@"token":strToken, @"user_id":strUserId};
[subscriber sendNext:dctProps];
[subscriber sendCompleted];
}
}];
}

它非常简单,即使您不熟悉 Reactive Cocoa。

出于某种原因,该代码对一个帐户有效(发布新闻),该帐户之前已获得授权,但是当我尝试为另一个帐户共享新闻时,它完成阻止但发送错误

FBSDKLog: Warning: Access token is missing publish_actions permissions

.显然,没有任何消息共享。

为什么会这样?

最佳答案

要允许使用 FBSDK 在您的应用程序内部发布,您必须在登录时向用户询问额外的权限:publish_actions

示例:

 [loginManager logInWithPublishPermissions:@[@"publish_actions"]
fromViewController:self
handler:^(FBSDKLoginManagerLoginResult *result, NSError *error) {
//TODO: process error or result.
}];

引用资料:
https://developers.facebook.com/docs/facebook-login/ios

关于ios - FBSDKLog 缺少权限,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37809687/

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