0

In my app, I would like to provide a facebook icon so my users can post to their wall. I have read ALOT about Facebook and the Facebook SDK, but I am hoping some Facebookers out there can give me some ideas on the best approach.

I have built a test app that logs in to facebook, but then I saw another app that brings me to the settings to configure facebook.

SO, what is the best way to do this in an app? Here are some questions:

1) Should I provide the login from my app, or is it better to use the built in native settings? 2) If the settings are better, is there an example of how I bring up the dialog? Do I use SLComposeViewController? 3) Do I ONLY need the Graph API?

I apologize if these questions are silly, but I have seen sooo many different ways, and many are pre 2012, so I do not want to do anything that is old. If I follow the Facebook docs, I do not see anything about the native iOS settings dialog.

Any help is greatly appreciated!!!!

LilMoke
  • 3,176
  • 7
  • 48
  • 88

2 Answers2

1

If all you are looking to achieve is post to the user's wall, I would recommend using the SLComposeViewController. This abstracts all the work in logging into Facebook and implementing the GraphAPI. A previous post answered this here: Tutorial for SLComposeViewController sharing

If you want more control over the Facebook integration, i.e. Read the User's Timeline, View/Change User Settings, etc. you will have to install the Facebook SDK and register your application with Facebook. This is more labor intensive, but the extra control and access to data may be what you need. The SDK can be access here as well as some demos and example code: https://developers.facebook.com/docs/ios

Community
  • 1
  • 1
Jeremy C.
  • 640
  • 6
  • 8
  • Ahhh, ok, so if I am only going to post a comment, or a comment with a picture, etc. I only need to use SLComposeViewController and I WILL NOT need the Facebook SDK... is that true? – LilMoke Feb 05 '14 at 16:12
  • That is correct, this will make the work a lot more easier if you use the built in iOS functionality. If the user is not logged in, or the Facebook account not set up, iOS will handle all of this and prompt the user for more information. Enjoy! – Jeremy C. Feb 05 '14 at 16:15
  • Ok, so, I am not an avid Facebook user, I am curious, is this what faceboook users expect? Do they normally set up Facebook, Twitter, etc. on the iPhone/iPad? – LilMoke Feb 05 '14 at 16:18
1

If you are going to post only text or image than better way is using SLComposeViewController. Why? No need to register app on developer.facebook.com. Native login, and easy to create post. Example to do it:

    SLComposeViewController *controllerSLC = [SLComposeViewController composeViewControllerForServiceType:SLServiceTypeFacebook];
[controllerSLC setInitialText:@"My post"];
[controllerSLC addURL:[NSURL URLWithString:@"http://www.example.com"]];
[controllerSLC addImage:[UIImage imageNamed:@"img.jpg"]];
[self presentViewController:controllerSLC animated:YES completion:nil];
Gago
  • 297
  • 1
  • 9
  • So if the user is logged in to his Facebook page on the device(using settings), will all his friends also see what my app posts? – LilMoke Feb 05 '14 at 16:32
  • Yes. If user is not logged in app will suggest to login. And after sending post it will visible for user's friends – Gago Feb 05 '14 at 18:49