Two iOS Apps Using the Same Facebook App Id - Is It Possible

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

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.

Can same facebook app id be used for both android and iphone app?

Yes, you can use the same application ID. You should, in fact, as it'll prevent you from having analytics and user permissions split between the two.

Multiple apps are using the same FaceBook Single Sign-On account, how to choose which one opens the login screen?

There's some specific changes that need to be made to support multiple IOS apps using the same Facebook app ID with the Single Sign-On Authentication

See https://developers.facebook.com/docs/howtos/share-appid-across-multiple-apps-ios-sdk/ for more information.

The most important things to check are:

  • Do you have the URL Scheme suffixes defined? (ie fb1234free:// instead of fb1234://)
  • Do you have those suffixes defined in the developer app in the order you want Facebook to use them?

One Facebook app associated with multiple iOS apps

We provided comma separated bundle ids of more than 200 iOS apps to the same Facebook App and Facebook integration is working fine in all iOS apps.

Share 1 Facebook App ID with multiple iOS Apps using ACAccountStore

Ahh, figured it out.

The good news is that this is definitely possible. Just go into your Facebook app's settings and add another bundle id.

Make sure that the bundle id you've set in your app is exactly the same as the one you add to facebook.

In my case, I was formatting part of my bundle id like so:

com.myApp.${MY_CUSTOM_BUNDLE_ID_SUFFIX:rfc1034identifier}.

MY_CUSTOM_BUNDLE_ID_SUFFIX is a User-Defined setting in my Target's Build Settings. I had it set to:

foo.bar

When processed with the rfc1034identifier, the . was converted to a - so it ended up being com.myApp.foo-bar, so the mismatch is what was causing login to fail.

Multiple native mobile apps on the same Facebook app

Yes. You can. See here

You can use one Facebook app ID in multiple Android apps. Just use the
same app ID in another app for login, sharing, and so on.

For deep linking and opening your app through notifications and other
means, we only support a single package name/class name combination.

Facebook & iOS: Share an app ID across multiple apps

Your issue is that the custom URL scheme is not being recognized by iOS. Here are some possible causes:

  1. I see that you've correctly set the CFBundleURLSchemes key in your plist to an array of supported schemes. You also need to set CFBundleURLName to something like com.myApp.MyURLScheme. Have you done this?

  2. After calling will and did finish launching methods, iOS will call your app delegate's - (BOOL)application:(UIApplication *)application openURL:(NSURL *)url sourceApplication:(NSString *)sourceApplication annotation:(id)annotation method. You must also implement this method and it must return YES. Have you?

  3. Make sure your URL format is correct. fbxxxxxxpremium://foo=bar won't work, but fbxxxxxxpremium://?foo=bar will (the ? is mandatory).

Please note that the delegate methods will be slightly different if you are targeting iOS 4.1 or earlier.

For more info and sample code, see the Communicating with Other Apps section of Advanced App Tricks in the iOS SDK documentation.



Related Topics



Leave a reply



Submit