From 6b1be3e0561a5f364675181dab7b92c8895e5400 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ullrich=20Sch=C3=A4fer?= Date: Wed, 18 Dec 2024 14:20:45 +0100 Subject: [PATCH 1/2] APNS production env for TestFlight --- packages/react-native-push-info/ios/PushInfo.swift | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/packages/react-native-push-info/ios/PushInfo.swift b/packages/react-native-push-info/ios/PushInfo.swift index fd415fa..c703fa8 100644 --- a/packages/react-native-push-info/ios/PushInfo.swift +++ b/packages/react-native-push-info/ios/PushInfo.swift @@ -8,8 +8,17 @@ class PushInfo: NSObject { @objc func constantsToExport() -> [String: Any]! { +#if targetEnvironment(simulator) + let apnsEnvironment = "development" +#else + var apnsEnvironment = embeddedProvision?.entitlements.apsEnvironment?.rawValue + if apnsEnvironment == nil { + let isTestFlight = Bundle.main.appStoreReceiptURL?.lastPathComponent == "sandboxReceipt" + apnsEnvironment = isTestFlight ? "production" : "development" + } +#endif return ["bundleId": Bundle.main.bundleIdentifier as Any, "teamId": embeddedProvision?.entitlements.teamId as Any, - "apnsEnvironment": embeddedProvision?.entitlements.apsEnvironment?.rawValue as Any] + "apnsEnvironment": apnsEnvironment as Any] } } From 5e35598a41f3daa8330157f5b595edac9cb13a58 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ullrich=20Sch=C3=A4fer?= Date: Wed, 18 Dec 2024 14:21:19 +0100 Subject: [PATCH 2/2] changeset --- .changeset/eighty-kids-end.md | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 .changeset/eighty-kids-end.md diff --git a/.changeset/eighty-kids-end.md b/.changeset/eighty-kids-end.md new file mode 100644 index 0000000..3763d2c --- /dev/null +++ b/.changeset/eighty-kids-end.md @@ -0,0 +1,5 @@ +--- +'react-native-push-info': minor +--- + +Fix for returning the wrong APNs environment on TestFlight