FacebookSDK iOS:使用图像将帖子添加到提要

FacebookSDK iOS:使用图像将帖子添加到提要,ios,facebook,cocoa-touch,facebook-graph-api,Ios,Facebook,Cocoa Touch,Facebook Graph Api,我已经知道如何将帖子添加到我的用户提要中,但目前需要使用图像URL: // The action links to be shown with the post in the feed NSArray* actionLinks = [NSArray arrayWithObjects:[NSDictionary dictionaryWithObjectsAndKeys: self.title,@"n

我已经知道如何将帖子添加到我的用户提要中,但目前需要使用图像URL:

// The action links to be shown with the post in the feed
NSArray* actionLinks = [NSArray arrayWithObjects:[NSDictionary dictionaryWithObjectsAndKeys:
                                                  self.title,@"name",self.url,@"link", nil], nil];
NSString *actionLinksStr = [jsonWriter stringWithObject:actionLinks];

// Dialog parameters
NSMutableDictionary *params = [NSMutableDictionary dictionaryWithObjectsAndKeys:
                               self.title, @"name",
                               @"Created using My App.", @"caption",
                               @"Check out the thing I just uploaded!", @"description",
                               self.url, @"link",
                               @"http://www.facebookmobileweb.com/hackbook/img/facebook_icon_large.png", @"picture",
                               actionLinksStr, @"actions",
                               nil];

[facebook dialog:@"feed" andParams:params andDelegate:self];

我想上传一个
UIImage
。我看到一些人在谈论如何使用
graphapi
。我如何做到这一点,并且仍然能够使用标题、标题和消息?

将您的四行代码替换为以下两行:

NSMutableDictionary *params = [NSMutableDictionary dictionaryWithObjectsAndKeys:YourUIImage, @"source",@"caption description",@"message",  nil];

[facebook requestWithGraphPath:[NSString stringWithFormat:@"/me/photos?access_token=%@", facebook.accessToken] andParams:params andHttpMethod:@"POST" andDelegate:self];
还有你的UIImage旁边的“YourUIImage”。
希望我回答了你的问题

非常感谢你的回答,这对我帮助很大。我想指出的是,在当前的Facebook SDK(我使用的是3.1.1)中,有了新的Graph API,但很明显,为了使您的解决方案正常工作,需要进行哪些更改。很高兴它对您有所帮助!是的,我的答案是10个月前,SDK可以改变很多事情!:)