SLRequest on iOS 6

How to connect UIImage to a Facebook post using SLRequest . This is my code:

SLRequest *facebookRequest = [SLRequest requestForServiceType:SLServiceTypeFacebook requestMethod:SLRequestMethodPOST URL:[NSURL URLWithString:@"https://graph.facebook.com/me/feed"] parameters:[NSDictionary dictionaryWithObject:post forKey:@"message"]]; 

I know that it is necessary to specify the image in the parameters, but I do not know how to do this.

+4
source share
1 answer

Add the image as multidata and with the name "picture".

 UIImage *myImage = [UIImage imageNamed:@"test.png"]; NSData *myImageData = UIImagePNGRepresentation(myImage); [facebookRequest addMultipartData:myImageData withName:@"picture" type:@"image/png" filename:nil]; 
+6
source

Source: https://habr.com/ru/post/1440582/


All Articles