From 2452fb681ded48aaa3a2f09bff1be5d794c31b43 Mon Sep 17 00:00:00 2001 From: emawby Date: Wed, 5 Apr 2023 12:56:08 -0700 Subject: [PATCH 1/2] Always set test type to 1 for simulators 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. --- iOS_SDK/OneSignalSDK/Source/OneSignal.m | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/iOS_SDK/OneSignalSDK/Source/OneSignal.m b/iOS_SDK/OneSignalSDK/Source/OneSignal.m index 87ecd2222..095659826 100755 --- a/iOS_SDK/OneSignalSDK/Source/OneSignal.m +++ b/iOS_SDK/OneSignalSDK/Source/OneSignal.m @@ -1857,9 +1857,13 @@ + (OSUserState *)createUserState { userState.carrier = carrierName; } + #if TARGET_OS_SIMULATOR + userState.testType = [NSNumber numberWithInt:(int)UIApplicationReleaseDev]; + #else let releaseMode = [OneSignalMobileProvision releaseMode]; if (releaseMode == UIApplicationReleaseDev || releaseMode == UIApplicationReleaseAdHoc || releaseMode == UIApplicationReleaseWildcard) userState.testType = [NSNumber numberWithInt:(int)releaseMode]; + #endif if (self.playerTags.tagsToSend) userState.tags = self.playerTags.tagsToSend; From 843dd5d014224360fd05cb7fa0477fa3c894cace Mon Sep 17 00:00:00 2001 From: emawby Date: Fri, 7 Apr 2023 10:22:30 -0700 Subject: [PATCH 2/2] adding test_type = 1 to simulator init unit test --- iOS_SDK/OneSignalSDK/UnitTests/UnitTests.m | 1 + 1 file changed, 1 insertion(+) diff --git a/iOS_SDK/OneSignalSDK/UnitTests/UnitTests.m b/iOS_SDK/OneSignalSDK/UnitTests/UnitTests.m index f721836d2..d15454a86 100644 --- a/iOS_SDK/OneSignalSDK/UnitTests/UnitTests.m +++ b/iOS_SDK/OneSignalSDK/UnitTests/UnitTests.m @@ -257,6 +257,7 @@ - (void)testInitOnSimulator { XCTAssertEqualObjects(OneSignalClientOverrider.lastHTTPRequest[@"notification_types"], @-15); XCTAssertEqualObjects(OneSignalClientOverrider.lastHTTPRequest[@"device_model"], deviceModel); XCTAssertEqualObjects(OneSignalClientOverrider.lastHTTPRequest[@"device_type"], @0); + XCTAssertEqual(OneSignalClientOverrider.lastHTTPRequest[@"test_type"], @1); XCTAssertEqualObjects(OneSignalClientOverrider.lastHTTPRequest[@"language"], @"en-US"); // 2nd init call should not fire another on_session call.