Skip to content

Commit 6be4cf7

Browse files
authored
fix: use locale-independent formatting for purchase prices (#1634)
* fix: use locale-independent formatting for purchase prices - Fixes an issue where purchase amounts were being formatted using the device's locale settings, causing European locales to send "12,99" instead of "12.99". This caused 400 errors from the API and blocked all user property updates. - The fix ensures the NSNumberFormatter uses en_US_POSIX locale, which always uses a period as the decimal separator regardless of device locale. * chore: update xcode ci for failing build
1 parent 48da315 commit 6be4cf7

2 files changed

Lines changed: 2 additions & 1 deletion

File tree

.github/workflows/ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ jobs:
1616
steps:
1717
- name: Select Xcode Version
1818
run: |
19-
sudo xcode-select -s /Applications/Xcode_16.3.0.app
19+
sudo xcode-select -s /Applications/Xcode_16.4.0.app
2020
- name: Checkout OneSignal-iOS-SDK
2121
uses: actions/checkout@v3
2222
- name: Set Default Scheme

iOS_SDK/OneSignalSDK/Source/OneSignalTrackIAP.m

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,7 @@ - (void)productsRequest:(id)request didReceiveResponse:(id)response {
127127

128128
// SKProduct.price is an NSDecimalNumber, but the backend expects a String
129129
NSNumberFormatter *formatter = [NSNumberFormatter new];
130+
[formatter setLocale:[NSLocale localeWithLocaleIdentifier:@"en_US_POSIX"]];
130131
[formatter setMinimumFractionDigits:2];
131132
NSString *formattedPrice = [formatter stringFromNumber:[skProduct performSelector:@selector(price)]];
132133

0 commit comments

Comments
 (0)