Hi! We noticed a somewhat rare crash that we’ve only recently been able to reproduce. This affects all iOS SDK version up to 4.17.5 (the latest at the time of writing). Basically we get a hard crash on
c"RCPurchases sharedPurchases] purchasePackage...];
The call stack simply points to libobjc.A.dylib at objc_msgSend within our method that calls purchasePackage.
We haven’t noticed this crash with the restorePurchasesWithCompletion call. The crash doesn’t happen with getOfferingsWithCompletion either.
We were finally able to reproduce this crash in the past few days with our TestFlight builds (and ONLY with TestFlight builds). We are calling all 3 methods from a thread that is not the main thread. Since only purchasePackage crashes (and on Android there are no crashes at all on any of the methods when not called from the UI thread), we never considered this to be an issue. However, then we queued the call the the main thread in iOS like this:
dispatch_async(dispatch_get_main_queue(), ^(void)
{
brRCPurchases sharedPurchases] purchasePackage...];
});
And it appeared that the crashes stopped.
We’re not sure whether we’re the ones at fault for not calling the methods from iOS’s main thread or whether there is a bug in the SDK, but a solution would be appreciated (either in the form of a fix for the SDK or mentioning in the documentation that RC calls should always be done from the main thread).
Can somebody confirm this issue?