ios Cordova 应用程序无法使用 Xcode 7.1 存档(未找到 Cordova/CDVViewController.h 文件)

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/33379291/
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-08-31 08:07:26  来源:igfitidea点击:

Cordova app failing to Archive with Xcode 7.1 (Cordova/CDVViewController.h file not found)

iosxcodecordova

提问by GoldenD

I've recently updated my Xcode to version 7.1 (from 7.0.1) and my Cordova app is failing to Archive with the error that says:

我最近将我的 Xcode 更新到了 7.1 版(从 7.0.1 开始),而我的 Cordova 应用程序无法存档并显示以下错误:

'Cordova/CDVViewController.h' file not found

找不到“Cordova/CDVViewController.h”文件

in MainViewController.h file.

在 MainViewController.h 文件中。

Searching through solutions on StackOverflow and elsewhere suggests that setting the project's Header Search Path from "$(OBJROOT)/UninstalledProducts/include"to "$(OBJROOT)/UninstalledProducts/$(PLATFORM_NAME)/include"seems to solve the issue for a lot of people. However, this did not resolve the issue for me.

在 StackOverflow 和其他地方搜索解决方案表明,将项目的 Header Search Path from "$(OBJROOT)/UninstalledProducts/include"to 设置"$(OBJROOT)/UninstalledProducts/$(PLATFORM_NAME)/include"似乎可以解决很多人的问题。但是,这并没有解决我的问题。

Is there anything that could be amiss? I never encountered a problem like this prior to updating Xcode.

有什么不妥吗?在更新 Xcode 之前,我从未遇到过这样的问题。

Associated screenshot: Notice the Header Search Paths for both Debug and Release

相关截图: 注意调试和发布的标头搜索路径

UPDATE:It seems like updating my Mac OS X to El Capitan might have fixed this problem as I no longer get it. At the time of posting this question, I was on Yosemite. Hope this helps anyone encountering the same issue

更新:似乎将我的 Mac OS X 更新到 El Capitan 可能已经解决了这个问题,因为我不再得到它。在发布这个问题时,我在优胜美地。希望这可以帮助任何遇到相同问题的人

回答by Franc

This is the solution!

这就是解决方案!

Add this line to your Build Settings -> Header Search Paths:

将此行添加到您的构建设置 -> 标题搜索路径:

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

回答by Simon Prickett

This is a problem with 7.1 check out this thread which may help (on the ionic forums but isn't an ionic specific issue, it's Cordova with XCode 7.1) http://forum.ionicframework.com/t/cordova-cdvviewcontroller-h-file-not-found-in-xcode-7-1-beta/32232

这是 7.1 的问题,请查看此线程可能会有所帮助(在离子论坛上,但不是离子特定问题,它是带有 XCode 7.1 的 Cordova)http://forum.ionicframework.com/t/cordova-cdvviewcontroller-h -file-not-found-in-xcode-7-1-beta/32232

回答by wumbo

I found a solution on this threadwhich worked for me with Xcode 7.1 (I was still having problems on OS X El Capitan).

我在这个线程上找到了一个适用于Xcode 7.1的解决方案(我在 OS X El Capitan 上仍然有问题)。

Gandhi's answer is:

甘地的回答是:

  • Run this in your terminal: cordova platform update ios
  • Open your project in Xcode
  • Go to Preference -> Locations -> Advanced
  • Choose "Unique" as the option for Build Location
  • Product -> Clean
  • Product -> Build
  • 在您的终端中运行:cordova platform update ios
  • 在 Xcode 中打开您的项目
  • 转到首选项 -> 位置 -> 高级
  • 选择“唯一”作为构建位置的选项
  • 产品 -> 清洁
  • 产品 -> 构建

回答by druid

I found this solution at http://forum.ionicframework.com/t/cordova-cdvviewcontroller-h-file-not-found-in-xcode-7-1-beta/32232:

我在http://forum.ionicframework.com/t/cordova-cdvviewcontroller-h-file-not-found-in-xcode-7-1-beta/32232找到了这个解决方案:

Add this line to your Build Settings -> Header Search Paths:

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

Don't replace the existing line that looks similar, that is still needed to be backwards compatible with Xcode 7 and Xcode 6.4.

将此行添加到您的构建设置 -> 标题搜索路径:

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

不要替换看起来相似的现有行,仍然需要向后兼容 Xcode 7 和 Xcode 6.4。

but doesn't work for old Cordova versions. I cannot upgrade to recent version of Cordova, so after a little try&search approach I found a new solution that seem works on my environment:

但不适用于旧的 Cordova 版本。我无法升级到最新版本的 Cordova,所以经过一些尝试和搜索方法后,我找到了一个似乎适用于我的环境的新解决方案:

"$(OBJROOT)/UninstalledProducts/$(CONFIGURATION)-$(PLATFORM_NAME)/include"

Same advice as before, don't replace the existing line, but append the new role at the end.

与之前的建议相同,不要替换现有行,而是在末尾附加新角色。

Hope this should be useful.

希望这应该有用。

回答by jcesarmobile

On the screenshot I see a whitespace on "build/UninstalledProducts/iphoneos/include ", try removing it.

在屏幕截图上"build/UninstalledProducts/iphoneos/include ",我看到一个空格,请尝试将其删除。

And you don't have to remove the old, "$(OBJROOT)/UninstalledProducts/include", you have to keep both

而且你不必删除旧的"$(OBJROOT)/UninstalledProducts/include",你必须同时保留