https://kotlinlang.org logo
#multiplatform
Title
# multiplatform
n

Nikita Khlebushkin

02/25/2020, 12:46 PM
TL;DR How to move/distribute built framework for iOS to another machine? Full story I have a framework in KMP with cocoapods dependency. I'm building it by ./gradlew modulepodspec, then add the location to Podfile and run pod install. Finally, I'm building iOS project that has the build phase from .podspec and it uses Framework and it's all good. Now, I need to plug the output framework into a project on another machine, so I go to build/bin/iosX64/debugFramework and send the myproject.framework to my friend on the another machine. He plugs it into Xcode, runs a build for simulator and gets
Copy code
Undefined symbols for architecture x86_64:
  "_OBJC_CLASS_$_AnalyticsInitParameters", referenced from:
      objc-class-ref in Analytic.o
  "_OBJC_CLASS_$_AnalyticsAnalytics", referenced from:
      objc-class-ref in Analytic.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
1. Is there a right way to distribute resulted iOS framework? 2. What am I doing wrong?
k

Kris Wong

02/25/2020, 1:45 PM
why mix cocoapods and manually sending frameworks?
when you build a framework, it doesn't embed all it's dependencies
n

Nikita Khlebushkin

02/25/2020, 1:46 PM
@Kris Wong what would be the right choice?
I was trying to look for how to publish a cocoapods from KMP, but I didn't find anything usable
k

Kris Wong

02/25/2020, 2:08 PM
you publish it the same way you do any CocoaPod
n

Nikita Khlebushkin

02/25/2020, 2:10 PM
I've never done this in my life
k

Kris Wong

02/25/2020, 2:10 PM
n

Nikita Khlebushkin

02/25/2020, 2:10 PM
Do you mean
pod lib create [pod name]
?
Awesome, thanks!
r

russhwolf

02/25/2020, 3:18 PM
Docs on cocoapods integration with Kotlin/Native at https://kotlinlang.org/docs/reference/native/cocoapods.html if it helps. There's a sample project linked on that page.
n

Nikita Khlebushkin

02/25/2020, 5:54 PM
@russhwolf in the sample and docs the cocoapod is used from Xcode locally, with a build phase that runs Gradle script and builds it. I don't really want to distribute a library that needs to be built by clients before using
8 Views