Search code examples
iosswifttestflight

Downloading from TestFlight app behavior


I recently submitted an app to Apple's TestFlight. I noticed that on downloading the app and launching the app, the expected flow would change. I've seen this happen before where the optimization level is different for release builds vs debug and some error during optimization results in different behavior when using Swift (I think it was during Swift 1, I'm now up to date with Swift 2).

I tried exporting for AdHoc and App Store Distribution and installing directly to a phone to see if I could reproduce the bad flow, but could not.

The errant flow is performing a different segue than expected.


Solution

  • Turns out the bad flow was the same flow I defined for opening the app from a push notification. I only have one situation where a push notification is triggered, so I didn't think I needed any logic to check what push was being received.

    It seems that if using Apple's TestFlight app, after downloading a desired app and selecting "Open" from within TestFlight, the app's application:didFinishLaunchingWithOptions: delegate method is called with launch options set. I was checking only for the existence of launchOptions, instead of checking that the launch options included UIApplicationLaunchOptionsRemoteNotificationKey. If the app is opened outside of TestFlight (ie go back to the home screen), the method is not called. I haven't yet verified what sort of information is available in the trigger from TestFlight, but I added logic to identify my push notifications.