Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Share content to Facebook from iOS 5 app

I'm developing a iOs 5 app and I would like that the user could share on Facebook some content from de app like text or images. I've tried to implement Sharekit (native fork and 2.0 modified fork) and Addthis but no one has worked. How can I do it? I was very close when I implement Sharekit 2.0 (modified fork) but it made some issues related to armv7. Is there some way for fixing them? Thanks for all!!

like image 378
Marti Serra Vivancos Avatar asked Mar 10 '12 19:03

Marti Serra Vivancos


1 Answers

I highly recommend using Facebook's SDK. There's a very thorough tutuorial here: Facebook iOS SDK. Once you've followed the instructions there and have Facebook authorizing your users account, you can use calls to the Graph API to post a variety of things (example of posting a link with the Graph API):

NSMutableDictionary *params = [NSMutableDictionary dictionary];

[params setObject:@"Test post" forKey:@"message"];
[params setObject:@"link" forKey:@"type"];
[params setObject:@"http://yoursite.com" forKey:@"link"];
[params setObject:@"Link description" forKey:@"description"];

NSString *graphPath = @"me/feed";

[facebook requestWithGraphPath:graphPath andParams:params andHttpMethod:@"POST" andDelegate:self];
like image 172
Jayson Lane Avatar answered Oct 19 '22 08:10

Jayson Lane