detecting debug vs ad hoc vs app store

Yes, the Right Way is to define another build configuration for ad hoc builds, but I've always regretted making Xcode projects any more complicated than they already are. This works and the runtime cost is minimal.

Update: As of 09/16/15, the file embedded.mobileprovision is still found in adhoc builds, but no longer seems to be present in TestFlight builds. Based on this, I'm also checking for an App Store receipt URL where the filename is sandboxReceipt.

typedef NS_ENUM(NSUInteger, AppBuildType) {  
@property (assign, readwrite, nonatomic) AppBuildType appBuildType;
#ifdef DEBUG
  self.appBuildType = AppBuildTypeDebug;
  #ifdef RELEASE
    NSString *embeddedProfilePath = [NSBundle.mainBundle pathForResource:@"embedded" ofType:@"mobileprovision"];
    NSString *appStoreReceiptFilename = [NSBundle.mainBundle.appStoreReceiptURL lastPathComponent];

    if ([NSFileManager.defaultManager fileExistsAtPath:embeddedProfilePath] ||
        [appStoreReceiptFilename isEqualToString:@"sandboxReceipt"]) {
      self.appBuildType = AppBuildTypeAdHoc;
    else {
      self.appBuildType = AppBuildTypeAppStore;
    #error Halt and catch fire.