RevenueCat/purchases-kmp

IOS crashes when calling Purchases.configure

Closed this issue · 3 comments

Qw4z1 commented

App crashes on startup when calling Purchases.configure using the latest version of the SDK. Verified that both API key and appUserId exists. Works as expected on Android.

Note: Only using purchases-kmp-core and PurchasesHybridCommon.

            Purchases.configure(
                PurchasesConfiguration(
                    apiKey = <API KEY>,
                ) {
                    appUserId(appUserId)
                }
            )
  1. Environment
    1. Platform: iOS
    2. SDK version: 1.0.0+13.2.0
    3. OS version: 17.5
    4. IDE (e.g. Android Studio, Xcode, Fleet): Android Studio
    5. IDE version:
    6. Device and/or emulator/simulator:
      • Device
      • Emulator/simulator
    7. Environment:
      • Closed testing / Sandbox
      • TestFlight
      • Production
    8. How widespread is the issue. Percentage of devices affected.
  2. Other information (e.g. stacktraces, related issues, suggestions how to fix, links for us to
    have context, eg. stackoverflow, etc.)
*** First throw call stack:
(
	0   CoreFoundation                      0x00000001804ae0f8 __exceptionPreprocess + 172
	1   libobjc.A.dylib                     0x0000000180087db4 objc_exception_throw + 56
	2   CoreFoundation                      0x00000001804c2da4 _CFAutoreleasePoolAddObject + 0
	3   CoreFoundation                      0x00000001804b2248 ___forwarding___ + 1280
	4   CoreFoundation                      0x00000001804b456c _CF_forwarding_prep_0 + 92
	5   VAC                                 0x0000000102016e78 kfun:com.revenuecat.purchases.kmp.Purchases.Companion.checkCommonVersion#internal + 424
	6   VAC                                 0x0000000102016810 kfun:com.revenuecat.purchases.kmp.Purchases.Companion#configure(com.revenuecat.purchases.kmp.PurchasesConfiguration){}com.revenuecat.purchases.kmp.Purchases + 428
	7   
*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '+[RCCommonFunctionality hybridCommonVersion]: unrecognized selector sent to class 0x106f28dd8'
*** First throw call stack:
(
	0   CoreFoundation                      0x00000001804ae0f8 __exceptionPreprocess + 172
	1   libobjc.A.dylib                     0x0000000180087db4 objc_exception_throw + 56
	2   CoreFoundation                      0x00000001804c2da4 _CFAutoreleasePoolAddObject + 0
	3   CoreFoundation                      0x00000001804b2248 ___forwarding___ + 1280
	4   CoreFoundation                      0x00000001804b456c _CF_forwarding_prep_0 + 92
	5   VAC                                 0x0000000102016e78 kfun:com.revenuecat.purchases.kmp.Purchases.Companion.checkCommonVersion#internal + 424
	6   VAC                                 0x0000000102016810 kfun:com.revenuecat.purchases.kmp.Purchases.Companion#configure(com.revenuecat.purchases.kmp.PurchasesConfiguration){}com.revenuecat.purchases.kmp.Purchases + 428
	7   VAC                                 0x00000001006f3780 kfun:se.sabumbi.vacapp.data.revenuecat.RevenueCatRepository.Companion#configure(kotlin.String){} + 648
	8   VAC                                 0x000000010065d528 kfun:$App$lambda$12COROUTINE$0.invokeSuspend#internal + 1372
	9   VAC                                 0x00000001012d6428 kfun:kotlin.coroutines.native.internal.BaseContinuationImpl#invokeSuspend(kotlin.Result<kotlin.Any?>){}kotlin.Any?-trampoline + 72
	10  VAC                                 0x000000010118c7a8 kfun:kotlin.coroutines.native.internal.BaseContinuationImpl#resumeWith(kotlin.Result<kotlin.Any?>){} + 648
	11  VAC                                 0x00000001012d6514 kfun:kotlin.coroutines.Continuation#resumeWith(kotlin.Result<1:0>){}-trampoline + 100
	12  VAC                                 0x000000010140a3bc kfun:kotlinx.coroutines.DispatchedTask#run(){} + 1760
	13  VAC                                 0x000000010143aab8 kfun:kotlinx.coroutines.Runnable#run(){}-trampoline + 92
	14  VAC                                 0x0000000101a67b38 kfun:androidx.compose.ui.platform.FlushCoroutineDispatcher.dispatch$lambda$1$lambda$0#internal + 476
	15  VAC                                 0x0000000101a6917c kfun:androidx.compose.ui.platform.FlushCoroutineDispatcher.$dispatch$lambda$1$lambda$0$FUNCTION_REFERENCE$4.invoke#internal + 76
	16  VAC                                 0x0000000101a69278 kfun:androidx.compose.ui.platform.FlushCoroutineDispatcher.$dispatch$lambda$1$lambda$0$FUNCTION_REFERENCE$4.$<bridge-DNN>invoke(){}#internal + 72
	17  VAC                                 0x00000001012d3628 kfun:kotlin.Function0#invoke(){}1:0-trampoline + 100
	18  VAC                                 0x0000000101a673d8 kfun:androidx.compose.ui.platform.FlushCoroutineDispatcher.performRun#internal + 320
	19  VAC                                 0x0000000101a67ce0 kfun:androidx.compose.ui.platform.FlushCoroutineDispatcher.dispatch$lambda$1#internal + 256
	20  VAC                                 0x0000000101a68c18 kfun:androidx.compose.ui.platform.FlushCoroutineDispatcher.$dispatch$lambda$1$FUNCTION_REFERENCE$0.invoke#internal + 140
	21  VAC                                 0x00000001012d6b38 kfun:kotlin.Function2#invoke(1:0;1:1){}1:2-trampoline + 116
	22  VAC                                 0x00000001011901ec kfun:kotlin.coroutines.intrinsics.object-4.invokeSuspend#internal + 740
	23  VAC                                 0x00000001012d6428 kfun:kotlin.coroutines.native.internal.BaseContinuationImpl#invokeSuspend(kotlin.Result<kotlin.Any?>){}kotlin.Any?-trampoline + 72
	24  VAC                                 0x000000010118c7a8 kfun:kotlin.coroutines.native.internal.BaseContinuationImpl#resumeWith(kotlin.Result<kotlin.Any?>){} + 648
	25  VAC                                 0x00000001012d6514 kfun:kotlin.coroutines.Continuation#resumeWith(kotlin.Result<1:0>){}-trampoline + 100
	26  VAC                                 0x000000010140a484 kfun:kotlinx.coroutines.DispatchedTask#run(){} + 1960
	27  VAC                                 0x000000010143aab8 kfun:kotlinx.coroutines.Runnable#run(){}-trampoline + 92
	28  VAC                                 0x000000010143603c kfun:kotlinx.coroutines.DarwinMainDispatcher.dispatch$lambda$0#internal + 68
	29  VAC                                 0x00000001014362c4 kfun:kotlinx.coroutines.DarwinMainDispatcher.$dispatch$lambda$0$FUNCTION_REFERENCE$1.invoke#internal + 72
	30  VAC                                 0x0000000101436394 kfun:kotlinx.coroutines.DarwinMainDispatcher.$dispatch$lambda$0$FUNCTION_REFERENCE$1.$<bridge-DNN>invoke(){}#internal + 72
	31  VAC                                 0x00000001012d3628 kfun:kotlin.Function0#invoke(){}1:0-trampoline + 100
	32  VAC                                 0x000000010143733c _6f72672e6a6574627261696e732e6b6f746c696e783a6b6f746c696e782d636f726f7574696e65732d636f72652f6f70742f6275696c644167656e742f776f726b2f343465633665383530643563363366302f6b6f746c696e782d636f726f7574	33  libdispatch.dylib                   0x0000000180170104 _dispatch_call_block_and_release + 24
	34  libdispatch.dylib                   0x0000000180171978 _dispatch_client_callout + 16
	35  libdispatch.dylib                   0x00000001801807c8 _dispatch_main_queue_drain + 1276
	36  libdispatch.dylib                   0x00000001801802bc _dispatch_main_queue_callback_4CF + 40
	37  CoreFoundation                      0x000000018040e960 __CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__ + 12
	38  CoreFoundation                      0x0000000180409078 __CFRunLoopRun + 1936
	39  CoreFoundation                      0x00000001804084d4 CFRunLoopRunSpecific + 572
	40  GraphicsServices                    0x000000018ef2aae4 GSEventRunModal + 160
	41  UIKitCore                           0x00000001853d0a28 -[UIApplication _run] + 868
	42  UIKitCore                           0x00000001853d46b0 UIApplicationMain + 124
	43  SwiftUI                             0x00000001ccf100e4 OUTLINED_FUNCTION_65 + 492
	44  SwiftUI                             0x00000001ccf0ff8c OUTLINED_FUNCTION_65 + 148
	45  SwiftUI                             0x00000001ccbcd6d8 OUTLINED_FUNCTION_0 + 92
	46  VAC                                 0x00000001005f84b8 $s3VAC6iOSAppV5$mainyyFZ + 40
	47  VAC                                 0x00000001005f8708 main + 12
	48  dyld                                0x0000000105cc9544 start_sim + 20
	49  ???                                 0x00000001057de154 0x0 + 4387103060
	50  ???                                 0xd54d800000000000 0x0 + 15370081840773726208
)
libc++abi: terminating due to uncaught exception of type NSException```

Hi @Qw4z1, thanks for reporting with the stack trace!

This line makes me think PurchasesHybridCommon is not properly linked:

reason: '+[RCCommonFunctionality hybridCommonVersion]: unrecognized selector sent to class 0x106f28dd8'

Just checking, did you run pod install --repo-update after you switched from the RevenueCat pod to PurchasesHybridCommon?

Qw4z1 commented

@JayShortway I thought I had, but it turned out that I had an issue in my cocoapod installation preventing me from updating pods. 😅 Closing this as it was an error on my part.

One thing before I go though I got this error now, which is pretty self explanatory. But shouldn't patch versions be allowed?

Uncaught Kotlin exception: kotlin.IllegalStateException: Unexpected version of PurchasesHybridCommon ('13.2.1'). Make sure to use '13.2.0' exactly.

@Qw4z1 Happy to hear it's solved!

Yea that could be a good idea. For now we want to minimize the variation in people's setups, but it could be something to consider for the future, thanks!