Hi, could someone help me understand why `toUIImag...
# moko
r
Hi, could someone help me understand why
toUIImage()
could be returning
nil
when called from Swift in the iOS project? The assets (images) and generated class show the image correctly in the build directory.
a
this can be because: 1. you use static framework and not add build phase in xcode to copy bundles from framework to app 2. you use moko-resources 0.22.1 where assets compilation is broken (fixed in 0.22.2) at first check your setup - if you use static framework you should add build phase in xcode. next check bundle content in compiled ios app. open .app, find inside your resources bundle (if static framework) or find inside your framework and inside it - resources bundle (in case of dynamic framework). Inside resources bundle you should see Assets.car - it's compiled assets. if you see Assets.xcassets - your assets not compiled, because of bug for example (on 0.22.1 it was)
r
Thank you for the detailed response! I had previously added the build phase in Xcode. When checking the compiled ios app, it has 2 bundles because the project uses a multi-module structure.
Copy code
- shared
-- data/resources
So, the 2 bundles are
projectname.shared.data/resources.bundle
and
projectName/shared.bundle
Inside these bundles, I see the following file and directory structure -
Copy code
- Contents
-- Info.plist
-- Resources
--- Assets.car
--- files
---- <empty>
a
so - your .bundle exist inside .app and Assets.car exist too? in this case i think problem in image - iOS can't create UIImage from this image asset. try add this image in sample project at github moko-resources. if problem will be reproduced on sample - create issue with this image please
r
Which project should I choose from the samples?
a
resources-gallery for example
1
r
Sorry to bother you again but I'm unable to build the
resources-gallery
project. Receiving this error -
Copy code
Showing Recent Messages
> Task :mpp-library:linkPodDebugFrameworkIosSimulatorArm64 FAILED

e: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ld invocation reported errors



The /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ld command returned non-zero exit code: 1.

output:

ld: unknown options: -ios_simulator_version_min -sdk_version
Could you help, please?
a
It's because you use xcode15 and in sample kotlin that not support xcode15. Use xcode14 or add in Gradle workaround from youtrack (search by ld error)
🙌 1
r
The same image is working fine in the
resources-gallery
project. It is not
nil
. So, I must be doing some misstep in configuration. Any ideas? Can I give you any additional info to figure out what could be reason?
a
1. image that you use - svg or png/jpg? 2. what ios deployment version in your app? 3. your kotlin framework is static or dynamic? 4. integration kotlin with xcode implemented with cocoapods or just regular framework? 5. can you show output of
find .
inside your
.app
directory?
r
Thanks for your response again. I have replied via a DM.