Still having trouble linking binary framework from...
# multiplatform
s
Still having trouble linking binary framework from KMM to my iOS app. Tried default “pack for xcode” task, installing as a Podfile, and can’t seem to import and reference it from within the iOS app still. Anyone have any tips what worked for them with larger modularized iOS apps?
w
surely not a best practise, but I gave up trying to use pod and I just link the .framework in the xcode project
s
How did you do that? I tried just adding manually to the Frameworks folder in the module I wanted to try and use it and still no luck
Were you able to access it?
w
did you copy the framework in the xcode project? The .framework file must be in the root of the xcode project, or in a subfolder
xcode let you search for it everywhere, but it won’t work if it’s outside the project folder
I made a custom gradle step that takes the framework and moves it in the xcode proj
s
Ok maybe that’s my mistake, I may have just copied the reference and not the actual file
w
task(“buildAndMerge”) { dependsOn(“build”) doLast { exec { commandLine = “rm -Rf ../ios/shared.xcframework”.split(” “) } exec { commandLine = “xcodebuild -create-xcframework -framework build/bin/ios/sharedReleaseFramework/shared.framework -framework build/bin/iosArm64/sharedReleaseFramework/shared.framework -framework build/bin/mac/sharedReleaseFramework/shared.framework -output ../ios/shared.xcframework”.split(” “) } } }
s
The KMM plugin now has a “Pack for Xcode” gradle task that is supposed to do it automatically but it didn’t work for me
w
this is it, I delete the old .xcframework if present and create a new one
yes, it doesn’t work to me neither
s
cool maybe I can try your variation thanks! 🙏
w
these are the targets: iosX64(“ios”) { binaries { framework(“shared”) } } iosArm64(“iosArm64”) { binaries { framework(“shared”) } } macosX64(“mac”) { binaries { framework(“shared”) } }
s
My iOS app is very complex and modularized so it may be harder than usual
w
let me know if it works for you 🙂
👍 1
s
Still trying to figure out why I can’t get any of the normal ways of automating framework delivery to work, in the meantime your tip about physically moving the framework seems to have done the trick for a short term solution.