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!!!!
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];
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
Related
I don't understand in order to create a Facebook share button is it a MUST to download their SDK, and get a Facebook App ID, then link App ID to .plist file and then link FBSDKShareKit.framework to project OR can I just use the social.framework and link that to project and use the following code...
if([SLComposeViewController isAvailableForServiceType:SLServiceTypeFacebook]) {
SLComposeViewController *controller = [SLComposeViewController composeViewControllerForServiceType:SLServiceTypeFacebook];
[controller setInitialText:#"high score is %i"];
[self presentViewController:controller animated:YES completion:Nil];
}
Doing it this way with social framework and the above code works fine. Or is it a MUST to add the Facebook SDK and get a App ID with a Facebook developer account and all that?
If I do it the social.framework way instead of using the Facebook SDK and Facebook App-ID would my app get rejected and would I have a problem with Facebook company?
It isn't a must to do it the SDK way, but it is recommended. Also your app won't be rejected for that, I guess.
The SDK way offers you much more functionalities regarding the Social framework. By using it and linking with an App ID you could track all the Insights regarding the activity of your users with FB, request permission to get some data from their FB profiles and link it among your other apps and maybe a FB page, FB login...
I created a Twitter and Facebook SHARE buttons. However, I don't know if i'm allowed to use the official Twitter bird logo and the official Facebook F logo as a custom image button on my app. Are developers allowed to do that or are we supposed to get permission from Facebook and Twitter? Or should I just create a custom button that says Facebook, Twitter on it? I've seen only official facebook and twitter logos on game apps and other apps. How is it done?
Both Facebook and Twitter have strict guidelines for that, which you can find on their corresponding developer sites. You will also find the necessary resources (i.e. images) on these sites. It is typically not ok to use custom images.
That said, the official guides are not always followed and personally I have never heard of anyone being held responsible for doing it wrong. But I would strongly encourage you to follow them in any case.
At least for Facebook, I would always advise to use the official SDK and the Share Button it provided. You can read more here: https://developers.facebook.com/docs/sharing/ios#triggering
FBSDKShareButton *button = [[FBSDKShareButton alloc] init];
button.shareContent = content;
[self.view addSubview:button];
Which of the 2 ways am I supposed to use to create a simple share button for Facebook in my game app?
1) import Social Framework into project and then put in the following code...
if([SLComposeViewController isAvailableForServiceType:SLServiceTypeFacebook]) {
SLComposeViewController *controller = [SLComposeViewController composeViewControllerForServiceType:SLServiceTypeFacebook];
[controller setInitialText:#"High score is %i"];
[self presentViewController:controller animated:YES completion:Nil];
}
2) Add Facebook SDK into your project, get a Facebook App ID by signing up to Facebook's developer program, then add App ID into .plist file, link FBSDKShareKit.framework into project and then use the code provided by Facebook (and there's a LOT of it).
The 1st way of doing it works perfectly fine. Is it a MUST for me to do it the 2nd way? If I do it the first way, would I get in trouble with Facebook or would Apple reject my app? Also, if I do it the first way does it mean I can't use the Facebook "f" logo for the Facebook SHARE button?
If you're planning on sharing OpenGraph Stories within your game I would go with the Facebook SDK. According to Facebook's official docs:
"iOS 6+ includes a native share sheet that lets people post status updates, photos, videos and links to Facebook and includes support for setting the audience for the post and tagging the post with a location. You cannot share Open Graph Stories with the share sheet. The Facebook SDK supports the use of this native controller.
While you can use the iOS native view controller API (share sheet) directly, there are several reasons to use the native iOS Share dialog provided by the Facebook SDK. Using the native Share dialog provides a quick way to test that people have signed into Facebook on their iOS 6+ devices"
If you need more information to decide, I suggest you take a look at Sharing on iOS
I was wondering what is a good way to create share buttons in iOS, and by share buttons I mean these 3 kinds of buttons:
1- Follow me on Twitter
2- Like a page on Facebook
3- Send a mail (Optional)
I have heard about sharekit but I am interested in just creating these 3 buttons that will be found on the back of the page of the app.
You can use something like:
NSString *launchUrl = #"http://twitter.com/intent/user?screen_name=USER NAME";
[[UIApplication sharedApplication] openURL:[NSURL URLWithString: launchUrl]];
which will open Mobile Safari and let you follow that user. You may be required to log in.
I guess there is a similar URL for Facebook.
To send a mail from within your app, use the MessageUI Framework.
Posting data to social services is much more complicated than just setting up a button. You must register your application, choose user, authenticate, then communicate via the internet.
ShareKit does most of that for you.
You may not just 'create share button' and have it share data to fb or twitter.
Posting to those service is complicated because you'll have to create Apps on those social networks as well as handle the oauth handshake the occurs which allows your app to share on behalf of the user. The Socialize SDK (www.getsocialize.com) is the fastest way to get Facebook/Twitter authentication without coding it yourself. Sample code below:
Socialize* socialize = [[Socialize alloc] initWithDelegate:self];
[self.socialize createShareForEntityWithKey:#"http://www.url.com" medium:SocializeShareMediumFacebook text:#"Check this out!"];
You could use ShareKit 2.0
https://github.com/ShareKit/ShareKit
I believe it supports sharing on most common social networks.
I searched about Facebook Like/Recommand/Share function for iOS for many many days. Today I finally come here to find what I need. So I doubt How to do this? For Facebook Developers Website's documents are not detail, especially on iOS. So I am asking questions here. Thank you very much.
The image is here.
Facebook has an iOS SDK - check here and here. Maybe this could help you...
You could also provide backend support for FB likes etc. using oAuth Flow. For that you could use Python, PHP or any other popular language to interface with FB Graph API
Maybe you wanna try BMSocialShare.
I try new facebook sharer dialog. You can find that here
But first of all, you must open a facebook app. I set facebook app type to mobil internet instead of ios.
Secondly you can use this code for sharing :
NSURL *shareURL = [NSURL URLWithString:#"https://www.facebook.com/dialog/feed?
app_id=458358780877780&
link=https://developers.facebook.com/docs/reference/dialogs/&
picture=http://fbrell.com/f8.jpg&
name=Facebook%20Dialogs&
caption=Reference%20Documentation&
description=Using%20Dialogs%20to%20interact%20with%20users.&
redirect_uri=http://www.facebook.com/"]
[[UIApplication sharedApplication] openURL: shareURL];
You have to change your app_id within this shareURL.
Lastly; i give same redirect uri for both facebook api and direct url.