我尝试通过 iOS 应用将照片发布到相册。我希望用户按他们的名字而不是页面所有者将他们的照片上传到粉丝页面的特定相册。
问题就像下面提到的问题:
Post a photo to an Album on a Facebook fan page without being the admin,
Post a photo to a page for iOS
这是我发布照片的代码
[params setObject:data forKey"source"];
FBRequest *request1 = [FBRequest requestWithGraphPath"v2.3/<album-id>/photos"
parameters:[NSDictionary dictionaryWithDictionary:params]
HTTPMethod"OST"];
我在哪里获得权限
- (BOOL)openSessionWithAllowLoginUIBOOL)allowLoginUI {
NSArray *permissions = [[NSArray alloc] initWithObjects:
@"publish_actions",
@"user_photos",
@"email",
@"user_likes",
@"publish_pages",
nil];
return [FBSession openActiveSessionWithPermissions:permissions
allowLoginUI:YES completionHandler:^(FBSession *session, FBSessionState status, NSError *error) {
switch (status) {
case FBSessionStateOpen:
break;
case FBSessionStateClosed:
break;
case FBSessionStateCreated:
break;
case FBSessionStateCreatedOpening:
break;
case FBSessionStateClosedLoginFailed:
break;
case FBSessionStateOpenTokenExtended:
break;
case FBSessionStateCreatedTokenLoaded:
break;
}
}];
}
当我开始请求时,我会收到错误,它说:
code = 200
"error_user_msg" = You don't have permission to edit this photo or album.
"error_user_title" = "Insufficient permissions"
"is_transient" = 0
message = "ermissions error"
我已经阅读了文档,看起来你只需要 publish_actions 这个权限和专辑 ID,然后你就可以在专辑上发帖。但我刚刚收到错误。
当我将相册 ID 更改为页面 ID 时,它会起作用,但照片不属于任何相册。
是我遗漏了什么还是我误解了文件?
您似乎遇到了访问 token 问题。 为了发布到属于某个页面的相册,您需要使用页面访问 token 而不是用户访问 token : 根据 documentation :
Page Access Token – These access tokens are similar to user access tokens, except that they provide permission to APIs that read, write or modify the data belonging to a Facebook Page. To obtain a page access token you need to start by obtaining a user access token and asking for the manage_pages permission. Once you have the user access token you then get the page access token via the Graph API.
您可以从 here 了解如何获取页面 token 。 .
关于ios - FB Api - 无法通过 IOS 应用将照片发布到页面的相册,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29558943/
欢迎光临 OStack程序员社区-中国程序员成长平台 (https://ostack.cn/) | Powered by Discuz! X3.4 |