Skip to content

Commit f07edcb

Browse files
committed
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.
1 parent 48da315 commit f07edcb

1 file changed

Lines changed: 1 addition & 0 deletions

File tree

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)