Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
bitfabrikken opened this issue Jun 7, 2022 · 9 comments · Fixed by #1720
Labels
📱 iOS Related to iOS

Comments

@bitfabrikken
Copy link

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.

@andresesfm andresesfm added the 📱 iOS Related to iOS label Jun 8, 2022
@andresesfm
Copy link
Contributor

andresesfm commented Jun 8, 2022

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
Copy link
Contributor

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

@andresesfm
Copy link
Contributor

This is my proposed solution: #1720

@hyochan
Copy link
Owner

hyochan commented Jun 15, 2022

Reopened because this is reverted in 8.1.1.

@sampsonjoliver
Copy link

sampsonjoliver commented Aug 9, 2022

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
Copy link

For visibility, the fix was reverted in PR #1724

@andresesfm
Copy link
Contributor

New attempt to fix this: #1846

@sampsonjoliver
Copy link

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 #1696

@andresesfm
Copy link
Contributor

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
📱 iOS Related to iOS
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants