Last active
November 10, 2016 18:26
-
-
Save nickplee/b599d727c2d516917e1ea1f6c002468b to your computer and use it in GitHub Desktop.
Detects the type of provisioning profile embedded in your app's bundle
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Inspired by: http://stackoverflow.com/questions/16243855/how-to-detect-that-a-provisioning-profile-is-for-development-or-distribution-pr | |
static let isDebugBuild: Bool = { | |
#if (!arch(i386) && !arch(x86_64)) && os(iOS) | |
guard let profileURL = Bundle.main.url(forResource: "embedded", withExtension: "mobileprovision"), var profileString = try? String(contentsOf: profileURL, encoding: .ascii) else { | |
return false | |
} | |
profileString = profileString.components(separatedBy: .whitespacesAndNewlines).joined() | |
return profileString.range(of: "<key>get-task-allow</key><true/>") != nil | |
#else | |
return true | |
#endif | |
}() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment