Hi, I am trying to integrate an iOS framework usin...
# multiplatform
p
Hi, I am trying to integrate an iOS framework using cinterop but it is not quite working. In gradle I have two modules,
:composeApp
and
:shared
. And in
:shared
I use cinterops to integrate an Obj-C framework, with separate cinterops invocation for iosArm64 and iosSimulatorArm64. The tests, i.e. commonTest, in
:shared
, successfully call expect/actual functions that exercise the Obj-C framework code. However, there is code in
:composeApp
that calls `:shared`'s expect/actual functions. It builds and runs, but fails at runtime with this error:
Copy code
Undefined symbols for architecture arm64:
  "_OBJC_CLASS_$_VersionInfo", referenced from:
       in ComposeApp.framework.o
ld: symbol(s) not found for architecture arm64
Any ideas?
Would I need to somehow manually update the xcode project, i.e.
iosApp/iosApp.xcodeproject
?
d
Getting similar error too Undefined symbols for architecture x86_64: “_OBJC_CLASS_$_NBPhoneNumberUtil”, referenced from: objc-class-ref in common(Common.framework.o) ld: symbol(s) not found for architecture x86_64
p
I suspect the xcodeproj needs to be opened in Xcode and manually updated.
image.png
image.png
I added an entry for to the obj-c framework and made a little progress. I now get a different error at runtime:
Copy code
Custom.framework did not have a CFBundleIdentifier in its Info.plist
Success! Here are the steps I used: • Manual update the xcodproj as shown in screenshots above ^^^ • Ensure
Info.plist
has a proper
CFBundleIdentifier
I am using my own custom obj-c framework, if you're using a third-party framework then most likely
CFBundleIdnetifier
is already set properly.
d
Thank you for sharing @Peter Tran