From c8de4605a12b16aedc7540bf18ff5d9e59ebf91f Mon Sep 17 00:00:00 2001 From: Davide De Rosa Date: Sun, 10 Sep 2023 08:08:26 +0200 Subject: [PATCH] Fix TestFlight sandbox detection on Mac (#354) The Mac `#if` block must come first because in Catalyst builds, `#if os(iOS)` holds true, and this is not the condition we want to validate on Catalyst. --- .../Sources/PassepartoutCore/Reusable/SandboxChecker.swift | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/PassepartoutLibrary/Sources/PassepartoutCore/Reusable/SandboxChecker.swift b/PassepartoutLibrary/Sources/PassepartoutCore/Reusable/SandboxChecker.swift index aaee53d4..b974ee09 100644 --- a/PassepartoutLibrary/Sources/PassepartoutCore/Reusable/SandboxChecker.swift +++ b/PassepartoutLibrary/Sources/PassepartoutCore/Reusable/SandboxChecker.swift @@ -46,9 +46,7 @@ public final class SandboxChecker: ObservableObject { } private func isSandboxBuild() async -> Bool { - #if os(iOS) - bundle.appStoreReceiptURL?.lastPathComponent == "sandboxReceipt" - #elseif targetEnvironment(macCatalyst) || os(macOS) + #if targetEnvironment(macCatalyst) || os(macOS) var status = noErr var code: SecStaticCode? @@ -79,6 +77,8 @@ public final class SandboxChecker: ObservableObject { requirement ) return status == errSecSuccess + #elseif os(iOS) + bundle.appStoreReceiptURL?.lastPathComponent == "sandboxReceipt" #else false #endif