appcues / appcues-ios-sdk

The Appcues iOS SDK
https://www.appcues.com/mobile
MIT License
8 stars 2 forks source link

Add support for automatic push environment detection #541

Closed mmaatttt closed 3 months ago

mmaatttt commented 3 months ago

Add a _pushEnvironment device auto property with a value of development or production. The value starts as unknown (which tracks as production) until a background thread can read and parse the provisioning profile data, if it's available.

There's a few options here:

  1. No embedded.mobileprovision. This could be a simulator build ( so want development) or an App Store one (production):

    App Store apps do not contain an embedded provisioning profile because the App Store checks that the app is signed and provisioned correctly as part of its app ingestion process.

  2. There is an embedded.mobileprovision. This could a development build (development) or an Ad Hoc build (production). In this case we can deserialize the provisioning profile and determine the correct environment, falling back to production if anything is unexpected. There's a few examples of doing this out there.

I haven't been able to test most of the error cases in a meaningful way because I can't modify the embedded.mobileprovision to do something unexpected. From what I've observed, most of the errors should never happen, but at least we'll be able to narrow things down if they do.

I have tested with a simulator, development build, and TestFlight (App Store) build. Our alpha/beta period will provide more opportunities to test different configuration.