RevenueCat / purchases-kmp

RevenueCat SDK for Kotlin Multiplatform
MIT License
70 stars 2 forks source link

Could not find or use auto-linked framework 'PurchasesHybridCommon': framework 'PurchasesHybridCommon' not found #177

Closed mirzemehdi closed 1 week ago

mirzemehdi commented 1 week ago

If I don't use Cocopoads, how can I solve this issue?

Could not find or use auto-linked framework 'PurchasesHybridCommon': framework 'PurchasesHybridCommon' not found.

https://www.revenuecat.com/docs/getting-started/installation/kotlin-multiplatform

I generated project from official kotlin app generator wizard. I can understand why this happens. In build.gradle file if I switch from


listOf(
        iosX64(),
        iosArm64(),
        iosSimulatorArm64()
    ).forEach {

        it.binaries.framework {
            baseName = "ComposeApp"
            isStatic = true
            export(libs.kmpnotifier)
        }
    }

to cocopoads, and add as a pod I guess problem will be solved. But is there any other workaround except switching to cocopoads? I tried to add RevenueCat using SPM in XCode but still problem occurs.

mirzemehdi commented 1 week ago

I also got this:

Undefined symbol: _OBJC_CLASS_$_RCCommonFunctionality
JayShortway commented 1 week ago

Hi @mirzemehdi! You don't need to switch your KMP module to be integrated with iOS via CocoaPods. You can keep integrating your KMP module with iOS as a direct local framework (which is how the JetBrains KMP wizard configures it). This section from the RevenueCat docs applies to your scenario.

Only your iOS project needs to use CocoaPods. That is, the project inside your iosApp folder. Check out the CocoaPods docs on how to add it. In the end, your iosApp/Podfile should contain this line:

pod 'PurchasesHybridCommon', '13.0.1'

The undefined symbol error you got is also caused by the fact that the PurchasesHybridCommon framework is not linked to your iOS project.

Let me know if you have any more questions!

lopspower commented 1 week ago

Hi 👋 ideally, you'd like to be able to add the “PurchasesHybridCommon” and “PurchasesHybridCommonUI” dependencies via Install via Swift Package Manager (like the RevenueCat SDK) rather than using Pod.

mirzemehdi commented 1 week ago

Thank you @JayShortway will add it with cocopoads then, I think it will work đź‘Ť

@lopspower yeah, I was expecting to be able to add PurchaseHybridCommon through SPM but couldn't succeed. Looks like it is not available there or not sure exactly

JayShortway commented 1 week ago

@lopspower It's indeed not available via SPM yet, but that's definitely on our radar! Thanks for letting me know this is something you'd like to see.

@mirzemehdi Alright, let me know if you need anything else!