Share content to Facebook from iOS 5 app

16,005

Solution 1

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

Solution 2

If you don't want to ask for additional permissions, you can use the Feed Dialog for iOS:

https://developers.facebook.com/docs/howtos/feed-dialog-using-ios-sdk/

Solution 3

If you are using IdeaShower's version of sharekit, it's no longer maintained. Try this one:

https://github.com/ShareKit/ShareKit

It's current and a lot of people keep it up to date.

Share:
16,005
Marti Serra Vivancos
Author by

Marti Serra Vivancos

Updated on June 28, 2022

Comments

  • Marti Serra Vivancos
    Marti Serra Vivancos almost 2 years

    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!!

  • Marti Serra Vivancos
    Marti Serra Vivancos about 12 years
    But how can I ONLY share a app's string and photo. I need something simpler.
  • Jayson Lane
    Jayson Lane about 12 years
    You mean your app's name? If so, that'll automatically show at the bottom of the post. For posting a photo, check out this question: stackoverflow.com/questions/4259573/…
  • TigerCoding
    TigerCoding about 12 years
    What is the error? Have you looked at the bug reports on github for something similar? They are very active in squashing them.
  • simonbs
    simonbs about 12 years
    I +1 this answer. When you only want to integrate a few services, SharingKit is rarely what you are looking for. Also, Facebook has a great SDK supported by good tutorials to get you going.
  • ViruMax
    ViruMax about 10 years
    will you answer this question?