Advertisement
Guest User

+ OneSignalMobileProvision releaseMode

a guest
Aug 22nd, 2016
174
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. + (UIApplicationReleaseMode) releaseMode {
  2.     NSDictionary *entitlements = nil;
  3.     NSDictionary *mobileProvision = [self getMobileProvision];
  4.     if (mobileProvision) {
  5.         [OneSignal onesignal_Log:ONE_S_LL_DEBUG message:[NSString stringWithFormat:@"mobileProvision: %@", mobileProvision]];
  6.         entitlements = [mobileProvision objectForKey:@"Entitlements"];
  7.     }
  8.     else
  9.         [OneSignal onesignal_Log:ONE_S_LL_DEBUG message:@"mobileProvision not found"];
  10.              
  11.     if (!mobileProvision) {
  12.         // failure to read other than it simply not existing
  13.         return UIApplicationReleaseUnknown;
  14.     }
  15.     else if (![mobileProvision count]) {
  16. #if TARGET_IPHONE_SIMULATOR
  17.         return UIApplicationReleaseSim;
  18. #else
  19.         return UIApplicationReleaseAppStore;
  20. #endif
  21.     }
  22.     else if ([[mobileProvision objectForKey:@"ProvisionsAllDevices"] boolValue]) {
  23.         // enterprise distribution contains ProvisionsAllDevices - true
  24.         return UIApplicationReleaseEnterprise;
  25.     }
  26.     else if ([@"development" isEqualToString: entitlements[@"aps-environment"]])
  27.         return UIApplicationReleaseDev;
  28.     else {
  29.         // app store contains no UDIDs (if the file exists at all?)
  30.         return UIApplicationReleaseAppStore;
  31.     }
  32. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement