[英]iPhone - How to post image on friend's facebook wall
if ([FBSession.activeSession.permissions indexOfObject:@"publish_actions"] == NSNotFound)
{
// No permissions found in session, ask for it
[FBSession.activeSession reauthorizeWithPublishPermissions:[NSArray arrayWithObject:@"publish_actions"]
defaultAudience:FBSessionDefaultAudienceFriends
completionHandler:^(FBSession *session, NSError *error)
{
// If permissions granted, publish the story
if (!error)
{
[self postImageToFB] ;
}
}];
}
// If permissions present, publish the story
else
{
[self postImageToFB] ;
}
- (void) postImageToFB
{
NSData* imageData = UIImageJPEGRepresentation(self.image, 90);
NSMutableDictionary * params = [NSMutableDictionary dictionaryWithObjectsAndKeys:
@"test", @"message",
imageData, @"source",
nil];
[FBRequestConnection startWithGraphPath:[NSString stringWithFormat:@"%@/photos",friendName]
parameters:params
HTTPMethod:@"POST"
completionHandler:^(FBRequestConnection *connection, id result, NSError *error)
{
NSLog(@"%@",error) ;
if( error == NULL )
{
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:nil
message:@"Post sucessed!!"
delegate:nil
cancelButtonTitle:@"OK"
otherButtonTitles:nil] ;
[alert show] ;
}
}];
}
I can use - (void) postImageToFB
function to post on my own wall when I change [NSString stringWithFormat:@"%@/photos",friendName]
to @"me/photos"
当我将
[NSString stringWithFormat:@"%@/photos",friendName]
更改为@"me/photos"
时,可以使用- (void) postImageToFB
函数在我自己的墙上发布
But I can't post on my friend's wall , maybe permission is wrong or there are some problem I didn't know ? 但是我不能在朋友的墙上张贴,也许许可错误或有一些我不知道的问题?
I got these error 我得到这些错误
Error Domain=com.facebook.sdk Code=5 "The operation couldn’t be completed. (com.facebook.sdk error 5.)" UserInfo=0xc0a7320 {com.facebook.sdk:ErrorInnerErrorKey=Error
Domain=NSURLErrorDomain Code=-1000 "bad URL" UserInfo=0xc001ea0 {NSUnderlyingError=0xaa45270 "bad URL", NSLocalizedDescription=bad URL}, com.facebook.sdk:HTTPStatusCode=200}
You cant Post to friends wall from now... 您不能从现在开始张贴到朋友墙...
Removing ability to post to friends walls via Graph API We will remove the ability to post to a user's friends' walls via the Graph API. 删除通过Graph API发布到朋友的墙上的功能我们将删除通过Graph API发布到用户的朋友的墙上的功能。 Specifically, posts against [user_id]/feed where [user_id] is different from the session user, or stream.publish calls where the target_id user is different from the session user, will fail.
具体而言,针对[user_id]与会话用户不同的[user_id] / feed张贴,或target_id用户与会话用户不同的stream.publish调用将失败。 If you want to allow people to post to their friends' timelines, invoke the feed dialog.
如果要允许人们发布到朋友的时间表上,请调用供稿对话框。 Stories that include friends via user mentions tagging or action tagging will show up on the friend's timeline (assuming the friend approves the tag).
通过用户提及标记或动作标记包含好友的故事将显示在好友的时间轴上(假设好友批准了该标记)。 For more info, see this blog post.
有关更多信息,请参见此博客文章。
Check this...changes mentioned at facebook developers portal https://developers.facebook.com/roadmap/completed-changes/#february-2013 检查此...在Facebook开发者门户https://developers.facebook.com/roadmap/completed-changes/#february-2013提及的更改
From the Link @viswa posted we can read 从发布的链接@viswa中,我们可以阅读
Removing ability to post to friends walls via Graph API We will remove the ability to post to a user's friends' walls via the Graph API.
删除通过Graph API发布到朋友的墙上的功能我们将删除通过Graph API发布到用户的朋友的墙上的功能。 Specifically, posts against [user_id]/feed where [user_id] is different from the session user, or stream.publish calls where the target_id user is different from the session user, will fail.
具体而言,针对[user_id]与会话用户不同的[user_id] / feed张贴,或target_id用户与会话用户不同的stream.publish调用将失败。 If you want to allow people to post to their friends' timelines, invoke the feed dialog.
如果要允许人们发布到朋友的时间表上,请调用供稿对话框。 Stories that include friends via user mentions tagging or action tagging will show up on the friend's timeline (assuming the friend approves the tag).
通过用户提及标记或动作标记包含好友的故事将显示在好友的时间轴上(假设好友批准了该标记)。 For more info, see this blog post.
有关更多信息,请参见此博客文章。
If you want to allow people to post to their friends' timelines, invoke the feed dialog . 如果要允许人们发布到朋友的时间轴上,请调用feed对话框 。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.