71

在 iOS 中,我更新了 7.2。我可以毫无问题地将我现有的项目构建到我的设备上。但是,当需要归档项目以准备提交到应用商店时,我遇到了构建错误 - 未找到 Cordova/CDVViewController.h 文件。我已经完成了几乎所有我没有找到 Stack Overflow 和 Google 的修复/解决方法,但没有一个对我有用。如果我回到 Xcode 6.4,我可以毫无问题地构建和存档,但现在我无法构建到我的设备,因为它运行的是 iOS 9.1。

我猜这是新 Xcode 版本设置的某个配置问题。有没有其他人遇到过这个?同样,通常的嫌疑人(首选项>位置>派生数据>高级>唯一),标题搜索路径等似乎都很好。

谢谢,阿迪舍舒

4

18 回答 18

238

由于搜索路径/包含,此问题似乎出现在 Xcode 7.2 中。

通过以下方式解决此问题:

  1. [projectName]在 Xcode TARGETS中选择您的。

  2. 转到构建设置选项卡。

  3. 确保过滤器设置为“全部”而不是“基本”。

  4. 搜索“标题搜索路径”

  5. 双击并将此路径添加到“调试”和“发布”:$(OBJROOT)/UninstalledProducts/$(PLATFORM_NAME)/include

  6. 现在清理项目并重新启动Xcode。

  7. 能够进行BuildArchive

  8. 就这样。

于 2015-12-31T12:42:23.557 回答
69

在尝试了所有解决方案都没有成功后,我跑了:

cordova platform update ios

这为我修好了。(XCODE 7.3.1,科尔多瓦 6.3.0)

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

于 2016-08-04T02:46:17.887 回答
7

如果添加此行:

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

到 headers-search-path (如 'im3r3k' 答案中所述)没有解决这个问题,也设置这个:

Build Settings -> Architectures -> Build Active Architecture Only -> YES
于 2016-05-11T08:13:58.397 回答
6

您应该将项目的 Cordova iOS 版本更新为3.9.2(截至 2016 年 3 月 11 日的最新版本 3)。我在使用 3.8.0 时遇到了同样的错误,它在 3.9 中得到了修复。

或者,您可以升级到 Cordova iOS v4.1.0(截至 2016 年 3 月 11 日的前沿),但请注意您将失去对 iOS 6 和 7 的支持,并且 cordova-plugin-screen-orientation尚未更新为使用 4所以你必须将你的应用程序锁定为纵向或横向。

编辑:

无需升级,您可以在 XCode 中手动修复此问题。去

构建设置 -> 标题搜索路径:更改:

$(OBJROOT)/UninstalledProducts/include

到:

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

apache.org 上的相关问题

于 2016-03-11T18:35:37.440 回答
4

这为我修复了它:

  • 在 Xcode 中打开你的项目
  • 转到首选项 -> 位置 -> 高级
  • 选择“唯一”作为构建位置的选项
  • 产品 -> 清洁
  • 产品 -> 构建

取自https://forum.ionicframework.com/t/cordova-cdvviewcontroller-h-file-not-found-in-xcode-7-1-beta/32232/40

于 2016-11-24T09:35:20.923 回答
3

我也遇到了这个问题,但对我来说,添加 Header Search 的路径是不够的。我已将CDVViewController.h添加到子项目CordovaLib.xcodeproj -> CordovaLib(target) -> Build Phases -> Headers -> Public的“公共”部分

于 2016-03-10T10:22:54.947 回答
3

对我来说,$(OBJROOT)/UninstalledProducts/$(PLATFORM_NAME)/include它已经在标题搜索路径中(在 El Capitan 中使用 XCode 8)。然后,我将文件夹的特定路径添加到用户标题搜索路径中,并启用了选项(对于像我这样没有经验的 XCode 用户,在树视图(第一个节点)中选择项目以查看“构建设置”!!)CordovaLibrecursive

但要注意空格!在丢失了很多之后,从查找器窗口中拖动文件夹会更安全,并且它填充为$(SRCROOT)/..(续),这不是预期的,但确实有效..

同样在XCode/Preferences/Locations/Custom Paths我添加了一个与以前相同的文件夹的CORDOVALIB名称,以相同的方式(这次,使用了完整路径,没有这个$(SRCROOT)东西)。

我花了好几个小时才弄清楚...

于 2016-09-24T20:51:34.970 回答
2

上述解决方案对我不起作用。

In my case, when I build my iOS platform, CordovaLib folder was not included.
1. Delete existing CordovaLib.xcodeproj
2. Add existing files. Add CordovaLib.xcodeproj from CordovaLib folder
3. Add dependencies and select CordovaLib
4. Add link Binaries with library and select libCordova.a

就是这样!

于 2016-12-03T12:45:49.810 回答
1

我使用的是 xcode 7.3,我遇到了同样的问题。在我的情况下,错误是由于执行“cordova platform add ios”时发生的错误,因为在 res 文件夹中找不到图像而发生错误,这避免了 cordova platform add ios 正确完成。

于 2017-03-10T14:48:39.010 回答
1
  1. 在你的 Xcode 项目设置中选择 TARGETS
  2. 在 TARGETS 中选择 Build Settings 选项卡
  3. 在 Build Settings 选项卡下的子选项中,请务必选择 All
  4. Scroll down to the Search Paths section
  5. Locate Header Search Paths
  6. Add the following configuration to the Release option (as a new value on its own line):$(OBJROOT)/UninstalledProducts/$(PLATFORM_NAME)/include
  7. Clean the project: Command + Shift + K
  8. Restart Xcode

The following screenshot demonstrates what you should see in Xcode 7.2 after following steps 1 to 6 (the line highlighted in blue displays the added configuration): enter image description here

于 2018-05-03T10:36:10.767 回答
1

One of the issue in my case was the one plugin cordova-plugin-inappbrowser. Make sure your plugins are updated.

于 2021-01-22T09:00:52.037 回答
0

还要在 Build Settings 中设置 ENABLE BITCODE = NO

于 2016-02-29T23:49:40.633 回答
0

我有同样的问题,所以我刚刚<icon src="icon.png" />从配置文件中删除。cordova platform remove ios然后我使用then删除并添加了 IOS 平台cordova platform add ios

于 2016-08-18T18:12:35.353 回答
0

对我来说,以下工作

Xcode 8.1 IOS 10.x

(目标 -> 构建设置 -> 标题搜索路径)

“${PODS_ROOT}/Cordova/CordovaLib/Classes/Public”

作为

“${PODS_ROOT}/Headers/Public”文件夹为空

于 2017-01-20T17:40:02.797 回答
0

当我删除并重新添加项目时,我遇到了这个问题,一些资源文件,如图标或闪屏,导致项目根本无法创建。

于 2017-02-19T02:51:01.250 回答
0

The CDV.h file is present in CordovaLib/CordovaLib.xcodeproj/public. You can give this path and worked for me.

I don't know how to give relative path. So I dragged/dropped the file and put it in "" with #import like:

#import "dragged file full path"
于 2018-07-27T02:02:34.383 回答
0

Uninstall And reinstall Cordova Platform

cordova platform rm ios

cordova platform add ios
于 2018-08-16T15:28:40.240 回答
-1

补充回复。添加

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

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

点击这里

于 2016-08-25T22:01:30.140 回答