react-native-iap
react-native-iap copied to clipboard
Hard crash on iOS calling getSubscriptions() for subscription with trial / promotional offer
Please use Discussion board if you want get some help out of it. Please report issue if there is a bug.
Version of react-native-iap
8.0.10
Version of react-native
0.67.2
Platforms you faced the error (IOS or Android or both?)
IOS
Expected behavior
Call getSubscriptions() without crashing
Actual behavior
Calling getSubscriptions() crashes the app.
Tested environment (Emulator? Real Device?)
Both
Steps to reproduce the behavior
Call getSubscriptions() within an app that's live on the App Store, which has a subscription with a promotional offer for a trial of 1 week.
I call this:
await RNIap.getSubscriptions(["supporter"]);
Then the console in Xcode says "Add new object : supporter", and crash occurs. Here's a crash log from device: https://pastebin.com/JvXBmzqz Let me know if anything else can help.
Hello @bitfabrikken Looking at the logs. Seems like this is the line where it blows up: https://github.com/dooboolab/react-native-iap/blob/main/ios/RNIapIos.swift#L776 Could it be that the discount has a strange/null price Locale? or maybe a discount is null itself? Hard to tell just by looking at the logs
Doesn't look like it can be null or have a strange value: https://developer.apple.com/documentation/storekit/skproduct/3043534-discounts
This is my proposed solution: https://github.com/dooboolab/react-native-iap/pull/1720
Reopened because this is reverted in 8.1.1
.
We are also seeing this crash in v8.6.5
, in our app. It is affecting our ability to update.
EXC_BREAKPOINT:
0 libswiftFoundation.dylib static Locale._unconditionallyBridgeFromObjectiveC(_:)
1 App specialized RNIapIos.getDiscountData(_:) (RNIapIos.swift:795:37)
2 App RNIapIos.getDiscountData(_:) (<compiler-generated>)
3 App RNIapIos.getProductObject(_:) (<compiler-generated>)
4 App thunk for @callee_guaranteed () -> () (<compiler-generated>)
5 App thunk for @escaping @callee_guaranteed () -> () (<compiler-generated>)
6 libdispatch.dylib __dispatch_client_callout
7 libdispatch.dylib __dispatch_lane_barrier_sync_invoke_and_complete
8 App RNIapIos.productsRequest(_:didReceive:) (RNIapIos.swift:445:15)
9 App @objc RNIapIos.productsRequest(_:didReceive:) (<compiler-generated>)
10 StoreKit ___34-[SKProductsRequest _handleReply:]_block_invoke
11 libdispatch.dylib __dispatch_call_block_and_release
12 libdispatch.dylib __dispatch_client_callout
13 libdispatch.dylib __dispatch_main_queue_callback_4CF$VARIANT$mp
14 CoreFoundation ___CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__
15 CoreFoundation ___CFRunLoopRun
16 CoreFoundation _CFRunLoopRunSpecific
17 GraphicsServices _GSEventRunModal
18 UIKitCore _UIApplicationMain
19 App main (main.m:7:12)
For visibility, the fix was reverted in PR https://github.com/dooboolab/react-native-iap/pull/1724
New attempt to fix this: https://github.com/dooboolab/react-native-iap/pull/1846
Unfortunately we haven't been able to deploy and verify this fix, as we've detected another crash after updating to 8.6.7 reported by @phillip-kic on https://github.com/dooboolab/react-native-iap/issues/1696
I'll close this as completed. I'll take a look at the other issue