How to prevent auto-launching of our iOS app from links in FB iOS app? - ios

We have an iOS app that publishes certain activity to Facebook that contains links to pages on our domain. Our intention is for friends to click on those links and view them as webpages.
However, when you click on links in these published stories in the FB iOS app, it's auto launching our app instead of going to an embedded Web View or kicking out to safari.
Note: We still want to have single sign on (SSO), so just want to change the behavior of clicking links in published stories.
To clarify, this is what I'm talking about:
My app is able to publishes http://foo.com/123 into the FB newsfeed for a particular user that opts in.
That person's friends see the link, but when they click it, it just goes to http://foo.com/123 in the browser instead of launching my FOO app. This is because my app doesn't yet handle incoming context from FB iOS app.
I still want FB SSO to work from my FOO app. That is, when clicking on FB sign in in my FOO app, it jumps out to the FB iOS app (if installed) and does a single sign on and redirects back to my app. IOW, I don't want to break this authentication scenario that currently works.
What setting in the FB developers App Settings controls this? It's not clear from the documentation. I see sections for Native iOS app and Website which I currently have set but it's unclear which sub-setting affects the behavior in question. Also, it's not clear even if I was to find the setting, can I affect it without affecting SSO.

The setting you want in the Facebook App dialog is under the iOS Native section (see the screenshot below) - set both the highlighted sections to Disabled.
This won't affect Facebook login/SSO in the app, so you'll still be able to do the OAuth dances.

Related

Firebase dynamic link does not navigate to ios app/ appstore from facebook post in iOS

I have to implement navigation from facebook post to my native iOS app or app store if the app is not installed. For that, I have tried Facebook APP Link feature but it did not work. Then I created Firebase Dynamic link and post it on facebook app directly. After tapping on posted link, it shows one pop up saying "Leave Facebook? This webpage is trying to open an app outside of Facebook. Are you sure you want to open it?"
After tapping on Yes, it does nothing. I have cross verified the created link with https://app_id.app.goo.gl/apple-app-site-association It shows associated bundle id, team id, app store id.
Can anyone please suggest me the proper pathway to implement deep linking with facebook post to the app?
Also, can we test deep linking with the app which is not on the App Store?
Thanks in advance.
Facebook doesn't like users to leave their app. They stopped supporting App Links in their iOS app almost a year ago, and have never supported Universal Links (which is what Firebase Dynamic Links uses).
The only workaround is to send users to a landing page with a CTA button, and put another deep link behind that button (on a different domain than the one on which you're hosting this landing page). It's an extra step for the user, but currently the only option. Branch.io (full disclosure: I'm on the Branch team) does this via the Deepviews feature. Dynamic Links currently doesn't have an equivalent, so you'd need to build something yourself.

iOS Facebook switches back to app between login & permissions

I'm trying to setup my app to publish a simple post to a user's Facebook feed (image url, link, description). They don't need to use Facebook for anything else so the first time they click "Share" it needs to authorize the app, and the publish permissions.
If they have their credentials stored in the device as of iOS 6 they simply get two alert boxes and it's done with. But if they don't, or have an older version, it switches out to Safari for login. My problem is that it is then switching the user back to my app, then immediately back again to Safari to accept the publish permission. It's very jarring and unprofessional.
What I would like is for the page in Safari to change after the login to the permissions page so they can accept it, and THEN switch back to my app. I know this can be done because the popular Mixology app does exactly this behavior. Unfortunately Facebook keeps changing their SDK and all the information I find online is outdated.
I wrote up a solution here: FacebookSDK presents login UI twice to avoid the double switch.
Basically, you can use openActiveSessionWithPublishPermissions: to do what you want. However, you have to handle the special case where the user has signed in to Facebook from the device settings, which requires requests for read and publish permissions into two separate calls.

How to tell an iphone app user what will happen before opening Facebook login dialogue

Apps that allow users to log in over a 3rd party authentication provider (e.g. Facebook, Google, Twoitter,...) should open a browser window to let the user authenticate against the provider. That means, at some point, an app is backgrounded and the user interacts with a browser window. Just before the browser opens, it's a recommended pratctice to inform the user about what will happen (see e.g. Getting Started with OAuth 2.0 - O'Reilly), let's say an alert window with something like "you will leave now the XYZ app and a browser window will open where you can enter your credentials safely".
My question: How can that be done if I use the facebook SDK for ios? Looking at the SDK, there seem to be no notifications and no designated states that would allow me to detect that the sdk is about to background my app and about to opening either Safari or the Facebook app.
Use a simple alert that explains what will happen when pressing the button (or however you choose to do it). And when the user has pressed the OK on the alert sign them in.
However I'm quite certain that in Facebook terms of service you have to have some sort of Facebook trademark before interacting with facebook and it seems like standard practice to mention facebook in some way on a button and then log-in the user without mentioning it, since it plays on the user expectation.
Especially when using iOS 6.0 and Facebook SDK 3.1 for iOS, then Facebooks SDK takes care of most of that in it's own.

Facebook Deep Linking on iOS not starting my app

I'm trying to implement Facebook's Deep Linking feature in order to launch game directly when the user taps a story in the native Facebook app. I've configured and enabled Deep Linking. I've then posted on my timeline using my app, it's a link to my game's site. The link contains a special GUID that enables some social activity in-game. When I click the link on web, my website opens normally. When I tap the story in native app, again, my website opens. However, if I tap the via part of the story in the bottom (such as 3 hours ago via MyApp) then my app launches, but it doesn't work for me as the GUID is not passed that way to the app (and also it would be useless to expect people to tap that part of the story). How can I set it up such that when the user clicks the link in a web browser, they will be taken to my website where there is a link to my app that they can download, but when they tap the same link in native Facebook App (only iOS is concerned), the game will launch and the link will be passed to my game? I don't know why it doesn't take me to the app when I click the link.
Here is a screenshot from my app's dashboard:
The URL scheme suffix is only for if I want to use the same ID for multiple apps, which is not the case.

Facebook App Requests aren't shown on iOS devices?

I've sent an app invitation from an iPad app to a test Facebook account via Facebook's API. When I login to the test account on my PC, the app request is there.
When I login to the test account on my iPad (either via Safari or via the Facebook App), I can see the number "1" next to the App Centre tab, but when I click it and go to the App Centre, there's no request. In fact, I can't see any App Centre areas dedicated to requests on Facebook for iOS - there's only Social Picks and Top Apps. Any explanation for this?
This is caused by an incorrect configuration on the Facebook app setting page. When you are setting up the app, you need to make sure the following is set correctly.
Go to developers.facebook.com then select "Apps". Edit your app and fill in the following..
iOS App Bundle (dont think it's essential but fill it in, this the bundle id from Xcode (com.companyname.appname))
iPhone/iPad App Store ID - This is ESSENTIAL, one of these must be filled in with a valid app store ID. You get this when you create an app with iTunes Connect. If you create an app, and fill in the details right up to the point where it asks you to submit the binary, it will generate what Apple refers to as an Apple ID (or iTunes Id?). It's just a long integer value. It doesn't have to be for the corresponding app, if you already have apps in the app store just log in to iTunes connect and use an existing one for testing.
Configured for iOS SSO - Enabled
Configured for Deep Linking - Enabled
The only functionality you get from Facebook when a user clicks an app notification on iOS is the user being redirected to the app, if installed, or to the App Store if not. Also if you want your app notifications to show up on desktop, you'll need a Canvas URL under the "App On Facebook" section.
In my tests I had to have a canvas URL to get iOS notifications working, but I'm not sure if this is a bug with Facebook or intended behaviour, so if it doesn't work with just iOS enabled, enable app on Facebook too and stick in a random url if you don't have one.
I just figured there can be another reason for this symptom: if your app has location restriction (only available in certain countries), the user who receives the request has to be in that country (e.g. I had to connect with mine via GeoEdge).

Resources