如何使用 SLRequest 将 UIImage 附加到 Facebook 上的帖子。这是我的代码:
SLRequest *facebookRequest = [SLRequest requestForServiceType:SLServiceTypeFacebook
requestMethod:SLRequestMethodPOST
URL:[NSURL URLWithString:@"https://graph.facebook.com/me/feed"]
parameters:[NSDictionary dictionaryWithObject:post forKey:@"message"]];
我知道需要在参数中指定图片,但我不知道如何制作。
最佳答案
将图像添加为多数据并命名为“picture”。
UIImage *myImage = [UIImage imageNamed:@"test.png"];
NSData *myImageData = UIImagePNGRepresentation(myImage);
[facebookRequest addMultipartData:myImageData withName:@"picture" type:@"image/png" filename:nil];
关于facebook - IOS 6 中的 SLRequest,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12958723/