归档 iOS 时找不到 Phonegap CDVViewController.h 文件

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

Phonegap CDVViewController.h file not found when Archiving for iOS

iosxcodecordova

提问by Reinaldo

I'm currently using Phonegap 2.0 to develop an iOS App in XCode. The app builds and runs fine in the emulator and also on the testing devices.

我目前正在使用 Phonegap 2.0 在 XCode 中开发 iOS 应用程序。该应用程序在模拟器和测试设备上构建并运行良好。

The problem appears when I try to archive the app for distribution. The archive fails with the following message:

当我尝试存档应用程序以进行分发时出现问题。存档失败并显示以下消息:

CDVViewController.h file not found.

未找到 CDVViewController.h 文件。

Any ideas?

有任何想法吗?

回答by Allan

Xcode 6.x

Xcode 6.x

add $(OBJROOT)/UninstalledProducts/includeto BuildSettings->Header Search Paths

添加$(OBJROOT)/UninstalledProducts/include到 BuildSettings->Header Search Paths

Xcode 7.x

Xcode 7.x

add $(OBJROOT)/UninstalledProducts/$(PLATFORM_NAME)/includeto BuildSettings->Header Search Paths

添加$(OBJROOT)/UninstalledProducts/$(PLATFORM_NAME)/include到 BuildSettings->Header Search Paths

1.Double click the <multiple values>and you can add this in.

1.双击<multiple values>添加即可。

2.Change $(OBJROOT)/UninstalledProducts/includeto $(OBJROOT)/UninstalledProducts/$(PLATFORM_NAME)/include

2.$(OBJROOT)/UninstalledProducts/include改为$(OBJROOT)/UninstalledProducts/$(PLATFORM_NAME)/include

enter image description here

在此处输入图片说明

回答by Hamid Tavakoli

On Xcode 7.1, you would need to update header search pathsfield from $(OBJROOT)/UninstalledProducts/includeto $(OBJROOT)/UninstalledProducts/$(PLATFORM_NAME)/include

Xcode 7.1 上,您需要将header search paths字段更新$(OBJROOT)/UninstalledProducts/include$(OBJROOT)/UninstalledProducts/$(PLATFORM_NAME)/include

You can find header search pathsunder build settings-> search paths

您可以header search pathsbuild settings->下找到search paths

回答by pablobart

Managed to fix it.

设法修复它。

These were missing from "Header Search Path" in the build setting of my TARGET settings:

我的目标设置的构建设置中的“标题搜索路径”中缺少这些:

"$(TARGET_BUILD_DIR)/usr/local/lib/include"
"$(OBJROOT)/UninstalledProducts/include"
"$(BUILT_PRODUCTS_DIR)"

Get the solution form multiple sources:

从多个来源获取解决方案:

Upgrading Cordova iOS (Stepts from 31) http://docs.phonegap.com/en/2.0.0/guide_upgrading_ios_index.md.html#Upgrading%20Cordova%20iOS

升级 Cordova iOS(从 31 步开始)http://docs.phonegap.com/en/2.0.0/guide_upgrading_ios_index.md.html#Upgrading%20Cordova%20iOS

Bug report https://issues.apache.org/jira/browse/CB-1122

错误报告https://issues.apache.org/jira/browse/CB-1122

Discussion at groups.google.com/forum/?fromgroups=#!topic/phonegap/IcR8-ijrUfk

在 groups.google.com/forum/?fromgroups=#!topic/phonegap/IcR8-ijrUfk 进行讨论

Discussion at groups.google.com/forum/?fromgroups=#!topic/phonegap/PzqZEm8QKmc

在 groups.google.com/forum/?fromgroups=#!topic/phonegap/PzqZEm8QKmc 进行讨论

回答by eton_ceb

For future ref:

对于未来的参考:

I just fixed this exact problem for myself.

我只是为自己解决了这个确切的问题。

If you are using Cordova cli, and have your config.xml updated, you can just remove ios as a platform and add it back. Then archive again from XCode.

如果您使用 Cordova cli,并且更新了 config.xml,您可以将 ios 作为平台删除并将其添加回来。然后再次从 XCode 存档。

cordova platform remove ios
cordova platform add ios

Hope that helps, worked perfectly for me,

希望有帮助,对我来说完美无缺,

回答by Jeffrey D. Hoffman

I was experiencing the exact same problem. I believe it may have been introduced because I moved the location of the Xcode project after I created it with Cordova's tools. Or, it may also be possible that I didn't properly setup the Cordova iOS toolset - perhaps I didn't run the installer package (I've rebuilt this machine a couple of times). Also, all the related answers I found with Google suggested I needed to change some of Cordova's core classes - which I wasn't willing to do.

我遇到了完全相同的问题。我相信它可能已经被引入,因为我在使用 Cordova 的工具创建它之后移动了 Xcode 项目的位置。或者,也可能是我没有正确设置 Cordova iOS 工具集 - 也许我没有运行安装程序包(我已经重建了这台机器几次)。此外,我在 Google 上找到的所有相关答案都表明我需要更改 Cordova 的一些核心类 - 我不愿意这样做。

My solution was to use the Cordova createcommand to build an entirely new Xcode project. I copied my original project's wwwdirectory into the new project and then went about re-configuring the new project to match the settings of the original project.

我的解决方案是使用 Cordovacreate命令来构建一个全新的 Xcode 项目。我将原始项目的www目录复制到新项目中,然后重新配置新项目以匹配原始项目的设置。

The new project, using the same plugins, frameworks and build settings successfully built an archive whereas the original project could not. It's not an ideal solution - but it worked.

新项目使用相同的插件、框架和构建设置成功构建了一个存档,而原始项目则不能。这不是一个理想的解决方案 - 但它奏效了。

回答by Brad Edwards

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

Adding this to the "Search Paths" section in "Build Settings" work perfectly.

将此添加到“构建设置”中的“搜索路径”部分效果很好。

Search Paths in XCode Build Settings

XCode 构建设置中的搜索路径

回答by Lano

I was facing the same issue when copying my project to another folder. I'm using Phonegap 2.0.0. After trying several solutions without success, I ran Product->Clean and everything worked properly. Do not ask me why but this path already solved several small glitches that I had to deal with, i.e. changing splash and icon files, who was not updated on device. Hope this help.

将我的项目复制到另一个文件夹时,我遇到了同样的问题。我正在使用 Phonegap 2.0.0。在尝试了几种没有成功的解决方案后,我运行了 Product->Clean 并且一切正常。不要问我为什么,但这条路径已经解决了我必须处理的几个小故障,即更改未在设备上更新的启动画面和图标文件。希望这有帮助。

回答by Austin

As is sometimes the case, an accepted solution may not help everyone with a similar but perhaps unrelated issue.

有时,一个被接受的解决方案可能无法帮助每个人解决类似但可能不相关的问题。

My observation was similar (CDVViewController.h not found). First ensure the TARGET settings includes "header search paths" as described above.

我的观察是相似的(未找到 CDVViewController.h)。首先确保 TARGET 设置包括如上所述的“标题搜索路径”。

Then follow this link to what worked for me: http://outof.me/embedding-cordovalib-in-your-iosphonegap-app-project/

然后按照这个链接对我有用http: //outof.me/embedding-cordovalib-in-your-iosphonegap-app-project/

Essentially I needed to re-link cordova as a target dependency and then Link it to my libraries.

本质上,我需要将cordova重新链接为目标依赖项,然后将其链接到我的库。

THEN, If you migrated to cordova 2.5.0, you will likely run into an issue that spits out something similar to this: ""_ALAssetPropertyDate", referenced from:

然后,如果您迁移到cordova 2.5.0,您可能会遇到一个问题,它会吐出类似于以下内容:“”_ALAssetPropertyDate”,引用自:

  ___23-[CDVFile getMetadata:]_block_invoke in libCordova.a(CDVFile.o)

  ___27-[CDVFile getFileMetadata:]_block_invoke in libCordova.a(CDVFile.o)

"_OBJC_CLASS_$_ALAssetsLibrary", referenced from:

“_OBJC_CLASS_$_ALAssetsLibrary”,引用自:

  objc-class-ref in libCordova.a(CDVFile.o)

  objc-class-ref in libCordova.a(CDVFileTransfer.o)

  objc-class-ref in libCordova.a(CDVURLProtocol.o)

"

If os, add the AssetLibrary framework and have some peace.

如果是 os,请添加 AssetLibrary 框架并稍作休息。

回答by KennyC

You may need to update your CordovaLib sub-project reference.

您可能需要更新 CordovaLib 子项目参考。

Launch Terminal Go to the location where you installed Cordova in the bin sub-folder. For example, /Users/Shared/Cordova/phonegap-2.2.0/lib/ios/bin

启动终端 转到您在 bin 子文件夹中安装 Cordova 的位置。例如,/Users/Shared/Cordova/phonegap-2.2.0/lib/ios/bin

Run the command below where the first parameter is the path to your project's .xcodeproj file:

运行下面的命令,其中第一个参数是项目的 .xcodeproj 文件的路径:

./update_cordova_subproject /path/to/your/project

回答by Carl Lewis

Xcode 7.2 is a little different

Xcode 7.2 有点不同

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

needs to be put in the header search paths for debug and for release.

需要放在用于调试和发布的头文件搜索路径中。

Header search paths have a debug and release sub field

标题搜索路径有一个调试和发布子字段