在 Xcode 终端中运行时找不到“Cordova/CDVViewController.h”文件

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/19728714/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-15 04:14:49  来源:igfitidea点击:

'Cordova/CDVViewController.h' file not found when run in Xcode terminal

xcodecordovajenkinsterminalxcode5

提问by maridob

So when I am trying to build my code from xcode terminal it is failing and giving me an error of 'Cordova/CDVViewController.h' file not found but when I am building this from xcode then it is building just fine.

因此,当我尝试从 xcode 终端构建我的代码时,它失败了,并提示我找不到“Cordova/CDVViewController.h”文件的错误,但是当我从 xcode 构建它时,它构建得很好。

In my Xcode, I've done the whole Cordova sub directory thing Upgrade Cordova. Also when I ran list. This is what I see below:

在我的 Xcode 中,我已经完成了整个 Cordova 子目录的升级 Cordova。当我运行列表时也是如此。这是我在下面看到的:

xcodebuild -list

xcodebuild -list

Information about project "myProject":

关于项目“myProject”的信息:

Targets:
    myProject

Build Configurations:
    Debug
    Release

If no build configuration is specified and -scheme is not passed then "Release" is used.

Schemes:
    myProject
    CordovaLib

Environment: Xcode5, OS 10.8.5

环境:Xcode5,OS 10.8.5

Is there anything I am missing? The reason why I am doing this because I am trying to run this through jenkins. I thought it was a jenkins issue but then I got it down to the xcode terminal not seeing the CordovaLib.

有什么我想念的吗?我这样做的原因是因为我试图通过 jenkins 运行它。我认为这是一个 jenkins 问题,但后来我把它归结为 xcode 终端没有看到 CordovaLib。

回答by maridob

I've spent too much time figuring out the solution for this so it is a shame not to share. There can be many possible reasons why this problem arise but if you feel like you've set up everything right in the CordovaLib (like me!) and still has the same problem. This can be one of the causes. What's happening is when I ran the

我花了太多时间找出解决方案,所以不分享是一种耻辱。出现此问题的可能原因有很多,但如果您觉得自己已经在 CordovaLib 中正确设置了所有内容(像我一样!)并且仍然遇到同样的问题。这可能是原因之一。发生的事情是当我运行

 xcodebuild  -scheme myProject -configuration "Release"

it is building successfully, but if you don't supply "-scheme" it it will fail by default it is using the "Release". The parameters of the scheme will control which targets are built and how they are built, myProject scheme contains the subfolder and reference to Cordovalib.

它正在成功构建,但如果您不提供“-scheme”,它将默认失败,它使用“Release”。该方案的参数将控制构建哪些目标以及如何构建它们,myProject 方案包含子文件夹和对 Cordovalib 的引用。

Now, moving to Jenkins, is you need to supply the scheme in the "Xcode Schema File" text box in the Advanced Xcode build options section of the XCode Plugin.

现在,转到 Jenkins,您是否需要在 XCode 插件的高级 Xcode 构建选项部分的“Xcode Schema File”文本框中提供方案。

My set-up is Xcode as my slave but this may still apply to whatever Xcode and Jenkins combination you have - so when I ran the

我的设置是 Xcode 作为我的奴隶,但这可能仍然适用于您拥有的任何 Xcode 和 Jenkins 组合 - 所以当我运行

 xcodebuild  -list

I receive the message the following message:

我收到以下消息:

If no build configuration is specified and -scheme is not passed then "Release" is used.

This project contains no schemes.

The solution for this is, in your xcode project, go to Product|Scheme|Manage Scheme and checked "Shared" to both projects myProject and CordovaLib. Compile. Check-in (because I am grabbing this from TFS). Ran again the "-list" command and you will see the schemes that you just shared.

对此的解决方案是,在您的 xcode 项目中,转到 Product|Scheme|Manage Scheme 并选中“共享”到两个项目 myProject 和 CordovaLib。编译。签到(因为我是从 TFS 获取的)。再次运行“-list”命令,您将看到您刚刚共享的方案。

Hope this helps!

希望这可以帮助!

回答by Simon Baudry

Thanks a lot ! Just adding "-scheme" and "-configuration" parameters fixed the problem for me.

非常感谢 !只需添加“-scheme”和“-configuration”参数即可解决我的问题。

If it can help someone else, here is the full command line i used :

如果它可以帮助其他人,这是我使用的完整命令行:

xcodebuild -scheme MyProject -configuration "Release" -arch i386 -sdk iphonesimulator7.1

xcodebuild -scheme MyProject -configuration "Release" -arch i386 -sdk iphonesimulator7.1

I used it to generate a ios simulator build in order to submit an Phonegap / Cordova application to the Facebook Review

我用它来生成一个 ios 模拟器构建,以便向Facebook Review提交 Phonegap / Cordova 应用程序

回答by Rita

In build settings add this item to "Header Search Path"

在构建设置中将此项目添加到“标题搜索路径”

$(OBJROOT)/UninstalledProducts/$(PLATFORM_NAME)/include