From 8f4274f10b64c8711dc3695f852cc083db19c7bb Mon Sep 17 00:00:00 2001 From: emawby Date: Wed, 9 Aug 2023 20:02:07 -0700 Subject: [PATCH] Always set test type to 1 for simulators Cherry-pick of #1244 Our provision detection in OneSignalMobileProvision is not successfully able to find the embedded mobile provision for simulators. This might only affect Xcode managed provisioning profiles. This change is a workaround to that issue to always set testType to 1 since simulators need to receive push in the sandbox environment. --- .../OneSignalUser/Source/OSSubscriptionModel.swift | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/iOS_SDK/OneSignalSDK/OneSignalUser/Source/OSSubscriptionModel.swift b/iOS_SDK/OneSignalSDK/OneSignalUser/Source/OSSubscriptionModel.swift index 4bfdbbcfa..3db62ca0e 100644 --- a/iOS_SDK/OneSignalSDK/OneSignalUser/Source/OSSubscriptionModel.swift +++ b/iOS_SDK/OneSignalSDK/OneSignalUser/Source/OSSubscriptionModel.swift @@ -218,6 +218,11 @@ class OSSubscriptionModel: OSModel { // Set test_type if subscription model is PUSH if type == .push { let releaseMode: OSUIApplicationReleaseMode = OneSignalMobileProvision.releaseMode() + #if targetEnvironment(simulator) + if (releaseMode == OSUIApplicationReleaseMode.UIApplicationReleaseUnknown) { + self.testType = OSUIApplicationReleaseMode.UIApplicationReleaseDev.rawValue + } + #endif // Workaround to unsure how to extract the Int value in 1 step... if releaseMode == .UIApplicationReleaseDev { self.testType = OSUIApplicationReleaseMode.UIApplicationReleaseDev.rawValue