Facebook deep linking in iOS - 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.

Related

How to make url that open in Safari for iOS Facebook Messenger app instead of in-app web browser

[iOS] I'd like to make facebook messenger bot that sends a URL. Once the URL is tapped, I want it to open the URL in native safari.app instead of an in-app browser in Messenger.app. I tried Safari-search URL scheme, but it doesn't work. Is there any way to open native safari by modifying URL without modifying iOS native source code because, you know, I can't make any change for FB messenger native app?
Typical scenario:
I am managing bot and send FB message with amazon product URL, let's say, https://www.amazon.com/gp/product/B00T85PMWY/.
The receiver tap the url.
Safari will open and show the page.
Open Facebook url in Safari instead of native app go get your answer

Adding Facebook as a Share button for iOS app

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

Coding a simple SHARED Button for Facebook

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

How to share a web image with twitter iOS API?

I have an iPhone app and I want the user to be able to tweet an image that the app displays. The image is already online. I'm wondering can I make the native tweet sheet show the image to the user as they type their tweet.
I know you can do [tweetSheet addImage:[UIImage imageNamed:#"image.png"]] But that is only for a local image that you are uploading to twitter while you tweet right?

Custom URL Scheme for sharing URL in native Facebook iPhone App

I know the available custom URL schemes for the native Facebook iPhone App:
What are all the custom URL schemes supported by the Facebook iPhone app?
But I can't find a way to publish a URL to my wall / timeline in that way, that Facebook collects / shows the site title and thumbnail as it does with the touch.facebook.com/sharer.php file.
The only way I see so far is to call
fb://publish/?text=www.domain.com
but this only post the link to my timeline, not title, thumbnail and site description.
Does anyone know a better way?
Basically you have two options:
You can either launch Safari using the Feed Dialog URL Scheme as explained here or use Facebook SDK as explained here.
If your App isn't integrated with Facebook already, it's probably easier to go with the first one.

Resources