yekeskin / flutter_avif

A flutter plugin to view and encode avif images.
https://pub.dev/packages/flutter_avif
MIT License
61 stars 17 forks source link

Not working on ios simulator #12

Closed LuisEGR closed 1 year ago

LuisEGR commented 1 year ago

Hello!

I've encountered an error trying to run a flutter app in the iOS simulator:

_In /Users/.../Documents/Github/flutter-app/ios/Pods/../.symlinks/plugins/flutter_avif_ios/ios/libflutter_avif.a(flutter_avif-9a73c8cc82382679.flutter_avif.0423e485-cgu.0.rcgu.o), building for iOS Simulator, but linking in object file built for iOS, file '/Users/.../Documents/Github/flutter-app/ios/Pods/../.symlinks/plugins/flutter_avif_ios/ios/libflutteravif.a' for architecture arm64

I am trying to use this with the iOS simulator on a M1 macbook air. It seems to have issues with the architecture. I've tried myself adding the new one but it looks like I don't have the required tools to create the .a file, I've tried but without success so far, so maybe you could try compiling it with the simulator architecture?

I'm trying to compile again with this added to the cargo/makefile:

cargo rustc --release --target=aarch64-apple-ios-sim --crate-type staticlib
lipo -create -output ../flutter_avif_ios/ios/libflutter_avif.a target/aarch64-apple-ios/release/libflutter_avif.a target/x86_64-apple-ios/release/libflutter_avif.a target/aarch64-apple-ios-sim/release/libflutter_avif.a

If you could compile and share the new .a file I could test it in my ARM. I'm hoping you can assist me in testing this.

Thanks!

yekeskin commented 1 year ago

Hi, can you try the 1.2.0-dev release? I have added binaries for aarch64-apple-ios-sim and aarch64-apple-darwin targets to support arm based macs.

LuisEGR commented 1 year ago

Awesome, I can confirm that this is working, I had to delete the ios/Pods/, ios/Podfile.lock and run flutter clean, but after that I could finally run my app in the iOS Simulator, and the images are being displayed correctly. Thank you so much!