Two iOS apps using the same Facebook app ID - is it possible? - ios

I'm using the latest facebook iOS SDK (supporting SSO) to connect my iPhone app with facebook. So far so good..
Since my current app is free with ads, I would like to create another version without ads (which i will charge for). I prefer not to use the in-app purchase approach.
The problem i'm facing is that with the facebook SSO, I need to bind the iOS application to a URL which is based on the facebook app ID. Since I have only one facebook app to be used by both of the iphone apps, the two iOS apps are binded to the same URL and therefore when both of them are installed on a device the callback from facebook to my app does not work (or opens the other app instead).
Is there a solution for that besides creating another facebook app dedicated to the new version of the iphone app?
Thanks.

I had to use FBLoginView in my app, and none of this solutions worked. The only missing thing was that i needed to add a new entry in the plist file: FacebookUrlSchemeSuffix (documented here, in the Step 2).
Suppose that your App ID is 123456, what i had to do was:
1) In your facebook app, add a URL Scheme Suffix in the iOS section:
2) In both of your applications, go to the app's .plist, and add the following entry:
Note that the Value must be one of the URL Scheme Suffixes added.
3) Also change your URL Scheme for Facebook in the .plist file to fb. For example, fb123456client

In the latest Facebook iOS SDK on Github there's a method called authorize:delegate:localAppId: initWithAppId:urlSchemeSuffix:andDelegate:. You can use the localAppId urlSchemeSuffix parameter to distinguish multiple iOS Apps that use the same Facebook application id. The method documentation says:
urlSchemeSuffix is a string of lowercase letters that is appended to the base URL scheme used for SSO. For example, if your facebook ID is "350685531728" and you set urlSchemeSuffix to "abcd", the Facebook app will expect your application to bind to the following URL scheme: "fb350685531728abcd". This is useful if your have multiple iOS applications that share a single Facebook application id (for example, if you have a free and a paid version on the same app) and you want to use SSO with both apps. Giving both apps different urlSchemeSuffix values will allow the Facebook app to disambiguate their URL schemes and always redirect the user back to the correct app, even if both the free and the app is installed on the device.
urlSchemeSuffix is supported on version 3.4.1 and above of the Facebook app. If the user has an older version of the Facebook app installed and your app uses urlSchemeSuffix parameter, the SDK will proceed as if the Facebook app isn't installed on the device and redirect the user to Safari.

Related

Consequences of mismatching Display name between Facebook iOS SDK and Facebook App Dashboard

In the Facebook documentation it states we should set the Display Name of our Facebook App, either by an entry into the plist with a key of FacebookDisplayName or by manually setting it on the Facebook SDK (setDisplayName: on FBSDKSettings)
https://developers.facebook.com/docs/facebook-login/ios#4--configure-your-info-plist
I am changing the name of my app. I have currently got previous versions of the app that use the Facebook Display Name App Name 1. I would like to change the name of the Facebook app to App Name 2. This means currently live apps will be using the wrong FacebookDisplayName.
I cannot find any documentation on what the effect of setting display name programmatically in the app actually is; it appears to do nothing.
What happens when the Facebook App name changes in the Facebook App Dashboard but old apps are using the old name?

Facebook redirection issue in iOS 9

Before iOS9, a Facebook post could successfully redirect an user to an installed app via short URL (like bet365://). Now, in iOS 9, bet365:// gives invalid link. From Safari it redirects fine, but not from Facebook browser. This is just an example, there are other apps that can't be opened from FB.
What do I need to do in order to open an installed iOS app from a Facebook post (in iOS9)?
PS: I understood that now, in iOS9, if Myapp1 wants to open Myapp2, it will need to populate info.plist with LSApplicationQueriesSchemes like this:
<key>LSApplicationQueriesSchemes</key>
<array>
<string>url_to_Myapp2</string>
</array>
but it's strage to belive that Facebook will have to do the same with the apps he wants to open.
Many thanks!
There are some changes you need to make in your plist and add a few urls to whitelist Facebook urls. Try adding all of them. It should work then.
Facebook iOS 9 integration
There are various ways you could go about achieving the same:
1. Use a platform like Branch or DeepLink.me
Use links generated by these platforms which will be opened in Safari and then redirected to your app.
2. Facebook App Links
This is the deeplinking solution provided by Facebook itself. Instead of generating static app url scheme links, you should generate applinks for sharing in Facebook. These can then redirect to your app or even the app store page if the app is not installed.
3. Support Universal Links in iOS 9
You can have iOS recognize universal links for your application. These will be in the form of http://yourWebsite/path/to/content and will result in your app being opened directly.
From the documentation:
Universal links let iOS 9 users open your app when they tap links to
your website within WKWebView and UIWebView views and Safari pages, in
addition to links that result in a call to openURL:, such as those
that occur in Mail, Messages, and other apps.
Have a look here on how to configure the same.
I would suggest configuring all of the above for your application, as it will provide various ways for you to direct users directly to your app, each suitable for certain situations.

anypic facebook login error

so, i followed the guidelines that is introduced on anypic github page.
1. I put my pplication ID and client key in appdelegate.m
2. I made my app named 'app1'on both facebook and parse.
3. I put my facebook app ID in info.plist
4. i also wrote the URL scheme in info.plist
5. I put my facebook app id and secret key in my parse account .
6.i also followed all the other changes including cloud code, js and etc.
7. I also submitted my anypic's bundle identifier to facebook dashboard.
(which was com.parse.anypic)
However when i run the app on my simulator, whenever i press the facebook button , the safari takes me to a web page saying 'the settings made by the developer is not proper to login(?)' well i'm not sure what this sentence actually means in english because i use different language on my virtual machine. Anyways if anyone knows anything about this problem please give me an answer..
Please check that you have made the Facebook app available to Public in your App Settings page.
Also You need to insert your platform details, for which platform you are developing your app and your development machine's keyhash. Make sure the key which you are using to debug your app is same whose keyhash value you enter on Facebook developer console.

iOS different bundle ids map to the same app

I'm trying to follow the convention described in this answer to manage both an app store and enterprise version of the same app but am seeing some really interesting behavior.
As described in the linked answer I've created a new scheme, defined a new 'Enterprise' build configuration and set up the enterprise scheme to use a separate and new bundle id. Both schemes point to the same target which relies on the new build config to toggle behavior. I am successfully able to generate an enterprise build and distribute it over-the-air, however, when I install both versions of the same app on the same simulator or phone the enterprise version actually runs the app store version of the app. Any changes that I make that are enterprise specific do not get reflected. Even when I close the app - the iOS7 animation back to the home screen animates back to the app store icon - not the enterprise one.
Obviously I want to be able to maintain these as separate versions that run independently. I feel like I must be fundamentally misunderstanding targets and schemes to get this kind of behavior. Any help would be greatly appreciated.
Pretty interesting bug.
What was happening was:
We were using facebook login to authenticate with our own services on the enterprise version.
The FB SDK would take over and kick out to a web/view or the fb app, depending on it's own logic. Critically - we were using the same facebook "app" configured on their developer site.
When fb returned it would call the url scheme denoted by fb{app_id}
iOS decided (consistently) to open the app that was first-installed that would respond to that URL scheme. In most cases this was the app-store version NOT the enterprise version.
The solution for this - maybe obviously at this point - is to use two different facebook apps so that iOS can route the returning OAuth response to the proper app. In keeping with the answer that I was originally working off this is best done by...
Creating a new user defined build setting entitled FACEBOOK_ID
Use your production app id for Debug and Release, while using the new id for Enterprise.
In your info.plist, change the value of your FacebookAppID to be ${FACEBOOK_ID}
In your URL Types, change the facebook scheme to be fb${FACEBOOK_ID}
This should successfully route your facebook login.
Keep in mind this is a general potential bug for ALL deep links - not just facebook login.
It is easier to use URL Scheme Suffix instead of separate Facebook apps. With URL Scheme Suffix you can add suffixes to the bundle id, for example: com.example.App.live and com.example.App.beta. That way the Facebook url scheme knows which app to open after authentication.
See the documentation on Facebook's developer site for more into: https://developers.facebook.com/docs/ios/troubleshooting#sharedappid

How can I Open Facebook from other app which is Installed & logged in Facebook App

I have seen an iPhone app Path and Installed in Device and in this app I have seen Facebook functionality means I have installed Facebook App and successfully logged in this app and now How can I open my profile,feeds,friend list and other functionality from my demo app so please give me idea how can I develop this functionality.
Any application can register a custom URL scheme, and when your app opens that URL, IOS will switch to the application that has registered that URL scheme. The Facebook app has registered such a scheme, with apparently quite some capabilities. See wiki.akosma.com.
However, I don't think that you can switch back to your app after that. So, if you just want to fetch some Facebook information, then you are probably better off using the Facebook web interfaces. You don't need to have the Facebook app installed at all when doing that.

Resources