2

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.

Community
  • 1
  • 1
jpredham
  • 2,149
  • 1
  • 23
  • 37

2 Answers2

2

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.

jpredham
  • 2,149
  • 1
  • 23
  • 37
0

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