简体   繁体   English

如何使用Facebook的REST API在应用程序配置文件页面上发布照片

[英]how to publish photo on application profile page using REST api of facebook

i am uploading photo to application(or like) profile page. 我正在将照片上传到应用程序(或类似)个人资料页面。 But it will show error message 但是会显示错误信息

"error_code":240,"error_msg":"Requires a valid user is specified (either via the session or via the API parameter for specifying the user." “” error_code“:240,” error_msg“:”要求指定有效的用户(通过会话或通过用于指定用户的API参数)。

i am using REST API for facebook. 我正在为Facebook使用REST API。

And this code NSMutableDictionary *params = [NSMutableDictionary dictionaryWithObjectsAndKeys: img, @"picture", kAppId,@"uid", nil]; 这段代码NSMutableDictionary * params = [NSMutableDictionary dictionaryWithObjectsAndKeys:img,@“图片”,kAppId,@“ uid”,nil];

[_facebook requestWithMethodName:@"photos.upload"
                       andParams:params
                   andHttpMethod:@"POST"
                     andDelegate:self];

where kAppId is applicatino ID. 其中kAppId是应用ID。 if i remove @"Uid" parameter then photo uploaded to my(user) photo album. 如果我删除@“ Uid”参数,则将照片上传到我的(用户)相册。

this thing is possible in web that user can upload a photo to like page as news feed. 用户可以在网络中将照片上传到类似页面的新闻提要中。 how we can do it through REST APi 我们如何通过REST APi做到这一点

Thanks 谢谢

您可能想尝试使用以下方法对参数进行urlencoding

[params dataUsingEncoding:NSASCIIStringEncoding allowLossyConversion:YES];

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM