简体   繁体   English

在Swift iOS App中使用TesseractOCR Objective-C框架(桥接头问题)

[英]Using TesseractOCR Objective-C framework with Swift iOS App (Bridging Header issues)

I am following this tutorial: http://www.raywenderlich.com/93276/implementing-tesseract-ocr-ios and I am using the latest Xcode (version 7 beta 3) and am having issues with importing the bridging header. 我正在关注本教程: http//www.raywenderlich.com/93276/implementing-tesseract-ocr-ios我正在使用最新的Xcode(版本7 beta 3),并且在导入桥接头时遇到问题。 I have searched various sites and have found many people posting solutions such as removing a certain setting like the "Objective-C Bridging Header" from the tests target or only putting it in the project or target settings. 我搜索了各种网站,发现许多人发布了解决方案,例如从测试目标中删除某个设置,如“Objective-C Bridging Header”,或者仅将其放入项目或目标设置中。 I have tried to change "no" to "yes" in the Build Settings in "Always Search User Paths", but that to no avail. 我试图在“始终搜索用户路径”中的“构建设置”中将“否”更改为“是”,但这无济于事。 The framework I added to the project has a "headers" folder and within that is the TesseractOCR.h file. 我添加到项目中的框架有一个“headers”文件夹,其中包含TesseractOCR.h文件。 I have tried so many things, I feel that either my issue is some random setting I need to configure or something obvious that I do not know of, with me being a beginner in Swift and no knowledge of Objective C, I would appreciate any guidance. 我已经尝试了很多东西,我觉得我的问题是我需要配置的一些随机设置或者我不知道的明显的东西,我是Swift的初学者而且没有Objective C的知识,我会很感激任何指导。

In my bridging header file I have included 在我的桥接头文件中,我已经包括在内

#import <TesseractOCR/TesseractOCR.h>

The two errors I get are 我得到的两个错误是

TesseractOCR/TesseractOCR.h file not found

Failed to import bridging header 'pathtoapp/AppName-Bridging-Header.h'

In project navigator press CMD+N (New File) - iOS - Source - Objective-C File - "type any name you want" - Next button - Create button. 在项目导航器中按CMD + N(新文件) - iOS - 源 - 目标-C文件 - “键入您想要的任何名称” - 下一步按钮 - 创建按钮。 Then you'll see alert asking you "Would you like to configure an Objective-C bridging header?" 然后你会看到警告问你“你想配置一个Objective-C桥接头吗?” - Yes. - 是的

Done , now just delete .m file because you don't need it. 完成 ,现在只删除.m文件,因为你不需要它。 Thats all :) 就这样 :)

add this to Library Search Paths 将其添加到库搜索路径

  • $(inherited) $(继承)

  • $(PROJECT_DIR)/tesseract-ios-lib/lib $(PROJECT_DIR)/正方体-IOS-lib的/ lib目录

在TesseractOCR框架上将“headers”目录重命名为“Headers”

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM