Hello, has anyone managed to add firestore analyti...
# multiplatform
d
Hello, has anyone managed to add firestore analytics using cocoapods? I am trying to do it for a very long time and I tried everything I could think of, so any even slightly related info or discussion would be appreciated. I tried adding
pod("Firebase/Analytics")
into build.gradle.kts, but that does not even sync, cause it can't generate cinterop for Firebase module. I managed to get it somewhat working by using
pod("FirebaseAnalytics")
instead and also adding needed dependencies FirebaseCore, FirebaseInstallations, GoogleUtilities and nanopb. But then I get a ton of warnings in runtime:
Copy code
Class FIRAConditionalUserProperty is implemented in both /.../MyApp.app/Frameworks/shared.framework/shared and /.../MyApp.app/MyApp.debug.dylib. This may cause spurious casting failures and mysterious crashes. One of the duplicates must be removed or renamed.
f
Hi, that’s a warning, your app can run but you will have weird behavior; il you use firebase from the swift iOS app side and from the the iOSMain side
If your shared module is a static library you won’t have this warning
d
@François Thanks for replying. Ok, so (just to confirm) I have to get rid of the warning so my app runs correctly? I will try switching to
isStatic = true
anyway. I could not build it that way before, but it might have been urelated, so i'll give it a proper go this time.
f
You can try my alternative of the cocoapods plugin. Spmforkmp, you will get ride of the warning in any build type, static or not.
d
Oh yes, I have seen that. It looks really promising. Do I have to write the bridges for every library?
f
Only for pure swift library
Firebase is almost written in objc
Your app can run with the warning you have. Write your IMPORTED code only in your iOS Swift App OR your iOSMain source set
And you won’t have weird behavior
d
Ah, yes as you said with
isStatic = true
it runs fine. idk how I managed to miss that. Thank you very much.