-
Notifications
You must be signed in to change notification settings - Fork 25
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support for Loading Images on iOS in KMP Project #113
Comments
Are you getting any useful error in onFailure? |
Thank you for your quick response. I get this
|
can you try wrapping it in File |
Can you provide me a quick example what you mean by "wrapping it in File"? I may I tried to wrap the path (data) in File, but this results in the following exception when building for iOS:
Thank you! |
Here's the example in the sample: It probably has to do with your path though. I don't think you can directly access files on your drive by absolute path from an ios simulator. Try bundling it as a resource like the sample does. This is probably relevant as well: https://stackoverflow.com/questions/37574689/how-to-load-image-from-local-path-ios-swift-by-path |
Problem Description:
I am working on a Kotlin Multiplatform (KMP) project where I need to load an image from the device’s file system. While the implementation works perfectly on Android, I am encountering issues on iOS where the image does not display. The path to the image seems correct, as I can verify the image exists on the iOS device’s file system. However, it does not render in the KamelImage.
Expected Behavior:
The image should load and display correctly on both Android and iOS devices using the same KMP codebase.
Actual Behavior:
• Android: Image loads and displays correctly.
• iOS: Image does not display, even though the file path is correct.
Code Example:
Here is the relevant portion of my implementation:
Example FileName:
iOS:
/Users/michael/Library/Developer/CoreSimulator/Devices/45D9A2D0-C80D-46E1-BC61-7AC048B75D47/data/Containers/Data/Application/9DD527DF-5093-46E5-BC6E-CB8B1FFBA835/Documents/story/images/img-3EdLqeuRN51sTaOcAvWMPFgW.png
Andorid:
/data/user/0/ch.huber.storki/files/story/images/img-3EdLqeuRN51sTaOcAvWMPFgW.png
Request:
Could you provide guidance on how to properly load images from the file system on iOS using KamelImage? Are there any known issues or additional steps needed to ensure compatibility on iOS?
Any assistance or advice would be greatly appreciated. Thank you for your hard work on this project!
The text was updated successfully, but these errors were encountered: