Test Bu swift3
func isSandboxed() -> Bool {
let bundleURL = Bundle.main.bundleURL
var staticCode:SecStaticCode?
var isSandboxed:Bool = false
let kSecCSDefaultFlags:SecCSFlags = SecCSFlags(rawValue: SecCSFlags.RawValue(0))
if SecStaticCodeCreateWithPath(bundleURL as CFURL, kSecCSDefaultFlags, &staticCode) == errSecSuccess {
if SecStaticCodeCheckValidityWithErrors(staticCode!, SecCSFlags(rawValue: kSecCSBasicValidateOnly), nil, nil) == errSecSuccess {
let appSandbox = "entitlement[\"com.apple.security.app-sandbox\"] exists"
var sandboxRequirement:SecRequirement?
if SecRequirementCreateWithString(appSandbox as CFString, kSecCSDefaultFlags, &sandboxRequirement) == errSecSuccess {
let codeCheckResult:OSStatus = SecStaticCodeCheckValidityWithErrors(staticCode!, SecCSFlags(rawValue: kSecCSBasicValidateOnly), sandboxRequirement, nil)
if (codeCheckResult == errSecSuccess) {
isSandboxed = true
}
}
}
}
return isSandboxed
}
için tam aradığım! Çalışırsa bir deneyin ve bu yorumu gözden geçireceğim. Teşekkürler. – NPAssoc
Not: Bu artık MacOS Sierra'da çalışmıyor (şimdiye kadar beta 1, 2 & 3). – Kyle
@Kyle Bu, High Sierra'da iyi çalışıyor gibi görünüyor. – Gino