Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Detect AppStore installation of iOS app

I need to implement a custom logging in my app.

To do this i need to detect if the current version of the app has been installed from the app store or is running from xcode or is a TestFlight version.

There is something different in the app depending from the installation source?

I don't want to have something different in the development environment.

like image 747
bago Avatar asked Apr 18 '13 16:04

bago


1 Answers

You can get part of the way there by reading in the embedded.mobileprovision file from the application bundle:

NSString *provisionPath = [[NSBundle mainBundle] pathForResource:@"embedded" ofType:@"mobileprovision"];

If that does not exist, you are in an app store build.

If it does exist, you need to figure out some difference between your debug and ad-hoc provisioning profiles, and look for that to determine which build you are in.

Because XCode automatically sets up applications with a "DEBUG" flag in the Debug config, that is not set in Release (which is used by default for AdHoc builds), you may be better off disabling logging in an app store build and determining the level of logging based on the DEBUG macro flag.

like image 85
Kendall Helmstetter Gelner Avatar answered Oct 23 '22 11:10

Kendall Helmstetter Gelner