Facebook SDK iOS: Add a post to submit an image

I figured out how to add a message to my channel for users, but currently this requires using the image 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]; 

I would like to download UIImage . I saw some people talking about using graph api for this. How can I do this and still be able to use the title, title and message?

+4
source share
1 answer

Replace the four lines of code with these two:

 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]; 

and 'YourUIImage' from your UIImage. I hope I answered your question!

+5
source

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


All Articles