How to handle facebook login with multiple targets? - ios

Here is my setup:
I have quite a few targets to run an app on the white-label method.
So each target has its own Info.plist, icons, names, etc.
The thing is that I want to have one login system only with facebook. So they all point to the same facebook app.
The problem: sometimes, when I login on app A using facebook, the facebook app open the app B.
I have all setup following the facebook guide with all bundle ids registered on facebook app, etc.
Has anyone had this issue before?

Solved it by forcing facebook login behavior to stay on a webview.
loginBehavior = FBSDKLoginBehaviorWeb
This way the users never leaver the app, so there is no chance of returning on a scheme opening the wrong app.

Related

Facebook login error: "The developers of this app have not set up this app properly for Facebook login"

I've been seeing error like this when trying to use Facebook Login.
I've checked everything including setting up the pList
and followed solutions in this link
The developers of this app have not set up this app properly for Facebook Login?
by setting the "
Do you want to make this app and all its live features available to the general public?" to YES
but then this image came up.
When I first try doing facebook login there's no need to even turn the live feature available to YES to make it work I wonder what went wrong.
Ok guys i found the solution, just go to facebook on your safari in the iOS simulator and log out the current user or test user and create a new test user. It should work!

How to handle URLs from Facebook Open Graph actions in iOS app

I'm building an iOS app that has Facebook open graph actions, and when I post an action on Facebook, on mobile app, I'm getting a link to my mobile app's ID on the App Store, which is not available yet. As a placeholder (otherwise Facebook doesn't save my settings), I've put an ID of another app that I have. Whenever I tap an Open Graph story on Facebook from my new app in Facebook iOS app, An App Store page of my previous app opens. I need the functionality to handle open graph action taps from Facebook iOS app before I submit my app to App Store. How can I test URL handling functionality in a such scenario?
Here is how my Facebook Native iOS App dashboard looks like:
Bundle ID matches my app's ID in my app exactly. iPhone/iPad App Store ID links to one of my previous apps, else Facebook doesn't accept my settings when I click Save button, complaining about app not yet being available on App Store. Facebook login and deep linking are both enabled, and URL schemes are registered the same way (the one starting with fb continues with my Facebook app ID) in the app bundle too. But still, my app doesn't launch when I tap a story on Facebook mobile app. Instead, a popup to install the app with the ID that I've specified launches (though, weird enough, I have that app installed too).
Facebook documents this here: https://developers.facebook.com/docs/ios/link-to-your-native-app-ios-sdk/
Just look under How to handle deep links to provide a more relevant user experience

What if Twitter or Facebook accounts are not configured on iOS 6?

Does anybody know a smart way to bring the user to enter their Facebook or Twitter account login information, if they aren't already logged in? For example, a user tries to log in my application with Facebook without configuring the Facebook account in the iOS settings. Can I ask him to do it with an alert, for example, but how can I bring him to the exact section of settings for that?
#rckoenes is correct. Under normal circumstances there is no way to manually send the user to preferences. There was a method of doing this introduced in iOS 5, but Apple quickly depreciated it in iOS 5.0.1 or 5.1 I don't remember exactly which one.
Now, on to the current situation. If you are using an SLComposeViewController in the Social Framework, you don't even have to worry about adding this functionality yourself. It is done automatically by iOS. Below is a screenshot from my 6.0 simulator attempting to post to Facebook without any accounts signed in. This is also true for Twitter and Sina Weibo.
You can't, there is no way to get the user to the settings app lett a lone the correct section.

How does facebook call the native iOS app?

I want to know how does facebook native app call my native iOS app.
Facebook requires App bundle id, app store id, and url sufix (optional). What I want to know is: how facebook process these information and open my native app?
It uses custom URL schemes.
What you basically do is define a "url" for your app so you can access it from anywhere in the OS (using that URL). What FB does, when it opens Safari to authenticate you for example, is specify YOUR app's custom url as a callback URL, so when it finishes, it calls that url and that redirects it back to your app.
You can test this by setting a custom URL for your app, firing up Safari, and typing that url. It will jump straight to your app.
You can read more about it here.
You don't need to set any of that to have the Facebook app send you back to your own app. The SDK does that automatically.
Setting the app bundle ID in your Facebook app (in the Facebook developer center) allows the Facebook app to send the user immediately back to your app if they've already given permission to your app before. It's just a nice feature, but it's not necessary for everything to work.

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

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.

Resources