Posting Images and Text to Timeline Using the Facebook SDK

Can I use the Facebook or Graph APIs to create a message like the one below?

enter image description here

I essentially want to combine these two together:

[FBRequestConnection startForUploadPhoto:[UIImage imageNamed:@"myImage"] completionHandler:nil]; [FBRequestConnection startForPostStatusUpdate:@"Hello, World!" completionHandler:nil]; 

Thanks.

+4
source share
2 answers

Use the following method:

 // Present share dialog [FBDialogs presentShareDialogWithLink:params.link name:params.name caption:params.caption description:params.description picture:params.picture clientState:nil handler:^(FBAppCall *call, NSDictionary *results, NSError *error) { if(error) { // An error occurred, we need to handle the error // See: https://developers.facebook.com/docs/ios/errors NSLog([NSString stringWithFormat:@"Error publishing story: %@", error.description]); } else { // Success NSLog(@"result %@", results); } }]; 

Here is the link: https://developers.facebook.com/docs/ios/share

+1
source

Try it,

  FBRequestConnection *connection = [[FBRequestConnection alloc] init]; NSMutableDictionary *dictionary = [NSMutableDictionary dictionary]; [dictionary setObject:UIImagePNGRepresentation(_image) forKey:@"picture"]; if (message) { [dictionary setObject:message forKey:@"message"]; } FBRequest *request = [FBRequest requestWithGraphPath:@"me/photos" parameters:dictionary HTTPMethod:@"POST"]; [connection addRequest:request completionHandler:^(FBRequestConnection *connection, id result, NSError *error) { }]; [connection start]; 
0
source

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


All Articles