Xcode引入TesseractOCR模块报错:No such module 'TesseractOCR'
Hey there, let’s fix that "No such module 'TesseractOCR'" error you’re hitting in Xcode. I’ve troubleshooted this exact issue dozens of times, so here are the most reliable fixes to try:
Fixes for "No such module 'TesseractOCR'" in Xcode
Double-check your installation & workspace setup
If you used CocoaPods:- Ensure you ran
pod installafter addingpod 'TesseractOCRiOS'to your Podfile. The biggest mistake here is opening the.xcodeprojfile instead of the generated.xcworkspace—always use the workspace when working with pods! - If the workspace still isn’t working, close Xcode entirely, delete the
Podsfolder andPodfile.lock, re-runpod install, then reopen the workspace.
If you used Swift Package Manager:
- Head to your project settings > Swift Packages, and confirm TesseractOCR is listed with a resolved version. If not, remove the package and re-add it using the repo URL:
https://github.com/gali8/Tesseract-OCR-iOS.
- Ensure you ran
Verify framework inclusion in your target
- For manual installations: Go to your target’s General tab > Frameworks, Libraries, and Embedded Content. Make sure TesseractOCR’s framework is listed, and set its embedding status to "Embed & Sign" (or "Embed Without Signing" if that fits your project’s signing setup).
- For CocoaPods users: Check your Podfile to ensure the pod is assigned to the correct target (critical if you have multiple targets in your project). Example:
target 'YourMainAppTarget' do pod 'TesseractOCRiOS' end
Clean Xcode’s build artifacts
- Xcode’s cached data often causes module issues. First, clean the build folder with
Cmd+Shift+K. Then delete your project’s Derived Data: Go to Xcode > Preferences > Locations > click the arrow next to Derived Data, find your project’s folder, and delete it. Restart Xcode and rebuild.
- Xcode’s cached data often causes module issues. First, clean the build folder with
Check build settings for path issues
- Go to your target > Build Settings > search for "Framework Search Paths". If you installed the framework manually, confirm the path to TesseractOCR’s framework is added here (use a relative path like
$(PROJECT_DIR)/Frameworksif possible). For package manager installs, this should be auto-configured, but a clean rebuild can fix any glitches here.
- Go to your target > Build Settings > search for "Framework Search Paths". If you installed the framework manually, confirm the path to TesseractOCR’s framework is added here (use a relative path like
Confirm version compatibility
- Make sure the TesseractOCR version you’re using matches your Xcode and iOS deployment target. Newer versions may require Xcode 14+ or iOS 13+, so check the library’s README for compatibility notes if you’re on an older setup.
内容的提问来源于stack exchange,提问作者David Kramf
相关产品推荐
相关产品推荐

