Hello, I have yet another question about cocoapods...
# kotlin-native
n
Hello, I have yet another question about cocoapods in K/N ☑️ I'm using
cocoapods
plugin, specify cocoapods dependency and run
:analytics:podspec
(where
analytics
is my KMP module) ☑️ podspec is generated and I'm using the project from Podfile ☑️
import analytics
works in Xcode ☑️ iOS project with the aforementioned Podfile builds successfully
import cocoapods.Analytics
is highlighted in red in Intellij Idea and causes compile errors such as
Packages cannot be imported
How do I make the frameworks appear in Kotlin project? Many thanks in advance Configuration files are attached to the thread
message has been deleted
b
might not matter that you're not using explicit cinterop (cocoapods instead)
n
@basher It isn't just IDE, the build from Xcode also fails as soon as I add import line
a
Packages cannot be imported, please try to add
.*
in the end of import line.
n
@Artyom Degtyarev [JB] Then it doesn't complain about imports, but if I try to use anything from the framework, I get "not resolved" build error
a
Can you try to open your bindings and look through it? It can be done in IDEA or via
klib
command-line tool, presented in your
~/.konan/kotlin-native-<hostname>-<version>/bin/
.
Your bindings should be located somewhere like
/build/classes/kotlin/ios/main/<projectname>-cinterop-Analytics.klib
.
n
message has been deleted
message has been deleted
a
Nice, this means you have those bindings generated correctly. Can you check now, is some specific class or function you use listed on any of those
<i>_Analytics.knm
? Also, is IDE suggesting something familiar when you try to import a concrete class rather than
.*
?
n
I'm using this class, for example
message has been deleted
It was in 0_Analytics.knm
IDE doesn't approve it
message has been deleted
Compiling also fails
/analytics/Tracker.kt: (19, 9): Unresolved reference: SEGAnalytics
a
Ok, and when you do it like,
Analytics.SEGAnalytics()
? This screenshot shows that you import all cocoapods packages instead of a concrete Analytics package.
Or just make import more detalized.
n
I tried this
message has been deleted
IDE still doesn't like it
BUT
XCode built it!
a
😤
n
Thanks a lot!
a
I suppose on some stage of this import dancing, IDEA just got stuck with it’s all indexing thing. Reopening the project can help in such cases, not the best option I know, but useful.
n
I casted a "Invalidate Cache and Restart" spell, but the errors didn't go away
message has been deleted
But it is something I can live with
a
Seems like Ben’s ticket is related to this one. For now, I can only recommend to go to the YouTrack and vote for it.
👍 1