khjde1207 / tesseract_ocr

Tesseract OCR for flutter
BSD 3-Clause "New" or "Revised" License
62 stars 31 forks source link

Error: could not find module 'SwiftyTesseract' for target 'arm64-apple-ios-simulator'; #25

Open MrFantuk opened 2 years ago

MrFantuk commented 2 years ago

Launching lib/main.dart on iPhone 11 in debug mode... lib/main.dart:1 Xcode build done. 3,1s Failed to build iOS app Error output from Xcode build: ↳ objc[14554]: Class AMSupportURLConnectionDelegate is implemented in both /usr/lib/libauthinstall.dylib (0x206e46b90) and /Library/Apple/System/Library/PrivateFrameworks/MobileDevice.framework/Versions/A/MobileDevice (0x1068942c8). One of the two will be used. Which one is undefined. objc[14554]: Class AMSupportURLSession is implemented in both /usr/lib/libauthinstall.dylib (0x206e46be0) and /Library/Apple/System/Library/PrivateFrameworks/MobileDevice.framework/Versions/A/MobileDevice (0x106894318). One of the two will be used. Which one is undefined. BUILD FAILED Xcode's output: ↳ Command CompileSwiftSources failed with a nonzero exit code /Users/denis/Desktop/development/programms/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_tesseract_ocr-0.4.19/ios/Classes/SwiftFlutterTesseractOcrPlugin.swift:3:8: error: could not find module 'SwiftyTesseract' for target 'arm64-apple-ios-simulator'; found: x86_64-apple-ios-simulator, x86_64, at: /Users/denis/Desktop/development/apps/nmo_helper/build/ios/Debug-iphonesimulator/SwiftyTesseract/SwiftyTesseract.framework/Modules/SwiftyTesseract.swiftmodule import SwiftyTesseract ^

Also removing from dev_dependencies: ... flutter_tesseract_ocr: projects works.

renatorv commented 2 years ago

I also have the same problem

khjde1207 commented 2 years ago

https://github.com/khjde1207/tesseract_ocr/issues/16 Can you please check if this method solves it?

ammaarkhan commented 1 year ago

Hi, I am still having this issue when attempting to run the example code mentioned in pub.dev. The issue link you mentioned issue doesn't help. Has anyone figured out the fix?

gigafunk commented 1 year ago

I have this problem, i think its a matter of not having arm64 , ie M1, apple silicone, support in the ios library this uses. There should be a way to tell xcode not to try to make an arm64 version, but i am too newb to figure it out. The swiftytesseract library's last update was adding the arm64 support, so it is either bugged in there, or this flutter plugin is still using the version before that.

https://github.com/SwiftyTesseract/SwiftyTesseract/releases/tag/4.0.1

Edit: this is an xcode bug introduced sometime in version 12 when they prepped for m1 support. I was finally able to exclude arm64 from all simulators when it when I used the exclude setting on the podfile, not in the iOS project as a whole, as I tried for days.

tranquockhanh0506 commented 8 months ago

I also have the same problem, any one fixed? Swift Compiler Error (Xcode): Could not find module 'SwiftyTesseract' for target 'arm64-apple-ios-simulator'; found: x86_64-apple-ios-simulator,

Could not build the application for the simulator. Error launching application on iPhone 14 Pro.

ammaarkhan commented 8 months ago

Hey @tranquockhanh0506, I couldn't get it to work, ended up using this lib: https://github.com/naveenvignesh5/rn-ocr-lib. Hope it helps.

tranquockhanh0506 commented 8 months ago

the lib only support react-native right? @ammaarkhan

ammaarkhan commented 8 months ago

yeah.. I'm not sure I understand your question. Did you click on the link? @tranquockhanh0506

tranquockhanh0506 commented 8 months ago

l clicked, but the lib you suggest me only support react native, but l want flutter :(((( @ammaarkhan

ammaarkhan commented 8 months ago

Oh! So sorry! I thought this library was for react native! Our team was exploring flutter but we ended up switching to react native. Apologies! @tranquockhanh0506

khjde1207 commented 8 months ago

I don't know how to solve it either. If there is someone who is good at it, please help them.

tranquockhanh0506 commented 7 months ago

@khjde1207 Have you solved it yet? :)))

gideonoyekale commented 7 months ago

Has anyone solved this yet? Still having the issue please

satet-dev commented 6 months ago

I encountered the same problem and was able to bypass it by excluding the arm64 architecture in the build configurations. Locate the Podfile in your XCode project (if you don't have one, try running your Flutter project and see if that changes anything; it will likely be under the Pods icon on the left menu in your XCode project). Flutter has something akin to the following placed at the end of the file:

post_install do |installer|
  installer.pods_project.targets.each do |target|
    flutter_additional_ios_build_settings(target)
  end
end

Change these lines in your Podfile to the following:

post_install do |installer|
  installer.pods_project.targets.each do |target|
    flutter_additional_ios_build_settings(target)
    target.build_configurations.each do |config|
      config.build_settings['EXCLUDED_ARCHS[sdk=iphonesimulator*]'] = 'arm64'
    end
  end
end

This should fix any errors that arise when using an iOS simulator with this library with M1 or M2 chips. Thanks.