react-native-iap icon indicating copy to clipboard operation
react-native-iap copied to clipboard

Hard crash on iOS calling getSubscriptions() for subscription with trial / promotional offer

Open bitfabrikken opened this issue 2 years ago • 8 comments

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.

bitfabrikken avatar Jun 07 '22 15:06 bitfabrikken

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

andresesfm avatar Jun 08 '22 20:06 andresesfm

Doesn't look like it can be null or have a strange value: https://developer.apple.com/documentation/storekit/skproduct/3043534-discounts

andresesfm avatar Jun 08 '22 21:06 andresesfm

This is my proposed solution: https://github.com/dooboolab/react-native-iap/pull/1720

andresesfm avatar Jun 08 '22 23:06 andresesfm

Reopened because this is reverted in 8.1.1.

hyochan avatar Jun 15 '22 14:06 hyochan

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)

sampsonjoliver avatar Aug 09 '22 23:08 sampsonjoliver

For visibility, the fix was reverted in PR https://github.com/dooboolab/react-native-iap/pull/1724

sampsonjoliver avatar Aug 11 '22 01:08 sampsonjoliver

New attempt to fix this: https://github.com/dooboolab/react-native-iap/pull/1846

andresesfm avatar Aug 11 '22 19:08 andresesfm

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

sampsonjoliver avatar Aug 15 '22 12:08 sampsonjoliver

I'll close this as completed. I'll take a look at the other issue

andresesfm avatar Aug 17 '22 16:08 andresesfm