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...
Related
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
For Share sheet for my iOS app. As I referred in this link How to display the default iOS 6 share action sheet with available share options?.
And I end up with below working code :
NSString *string = #"Some text to share";
UIActivityViewController *activityViewController = [[UIActivityViewController alloc] initWithActivityItems:#[string]
applicationActivities:nil];
[self presentViewController:activityViewController
animated:YES
completion:^{
NSLog(#"complerted.");
}];
But I can see only Email & Message button !!?
How can I get other social media buttons in Share sheet like Facebook , twitter as seen below. Even though user account not available/created in device? (As we can see iOS default Photos app, where the share sheet has social buttons even though for example facebook not installed in the device!) Should I enable or extend extension?
Please help,
Thanks & Regards,
//Update
- I added iOS-8 social framework and imported #import <Social/Social.h>.
This UIactivityController show the app which can share your string or image. If you have not added any Facebook or twitter account than that will not show that app in this action sheet.
Try by adding Facebook and twitter account in your devices setting. you will able to see that app too.
You have a More button in your share sheet. Tap on it & it will shows all the available Extension & turn on it for Facebook & Twitter.
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
Everything works fine however the post on Facebook says "... via iOS device" and I want it to say the name of the actual app. What am I doing wrong?
Here is my code:
- (IBAction)doFacebook:(id)sender{
//check to see if facebook account exists
if ([SLComposeViewController isAvailableForServiceType:SLServiceTypeFacebook]) {
// Create the view controller defined in the .h file
fb=[SLComposeViewController composeViewControllerForServiceType:SLServiceTypeFacebook];
// make the default string
NSString *FBString= [NSString
stringWithFormat:#"%#\r via #GibberishGenerator", gibText.text];
[fb setInitialText:FBString];
// show the controller
[self presentViewController:fb animated:YES completion:nil];
}
}
iOS 6 Share Sheet
The iOS 6 share sheet is a feature of Apple's Facebook integration.
Disadvantages
Posts from the share sheet are attributed to iOS by default; contact Facebook to correctly configure attribution for your app
Sharing and Distribution on iOS
In my iOS app, I am posting videos link (e.g. YouTube video link) and when user click on these link from native Facebook app of iOS the video should open in my app. When I post videos link it shows same as when we post video link from our Facebook profile (suppose post video link then it automatically fetch its info and post it as thumbnail image with some information).
So the problem is when I click on this post from native Facebook app of iOS it is opening in webview instead of open my app. I also enabled "Deep Linking" in facebook app settings of application. The code I use is shown below
SLComposeViewController *fbVC = [SLComposeViewController composeViewControllerForServiceType:SLServiceTypeFacebook];
[fbVC setInitialText:#"Check out this video :"];
[fbVC addURL:[NSURL URLWithString:#"http://www.youtube.com/watch?v=NoVW62mwSQQ"]]; //youtube video is example
[self presentViewController:fbVC animated:YES completion:nil];
And if post this link from "setInitialText" parameter then it is simple shows as link (not as a automatic rectangle with thumbnail image and some info ) then it open app but I do not want in this way because it also shows value passed in "deeplink" parameter like "http://www.youtube.com/watch?v=NoVW62mwSQQ/?deeplink=mypost" in the post.
The deep linking is available only for the post made by your application not on the link shared by the users.
For example a youtube video is opened in webview not in the application.
A possible solution is to catch the device from your website and then open the app.