iPhone 应用程序在发行版构建时出现静态库编译错误

发布于 2024-08-04 23:55:29 字数 854 浏览 3 评论 0原文

我目前正在尝试构建我的(第一个)iPhone 应用程序的分发产品,以便将其上传到 App Store。我已经完成了所有应用程序 ID 和分发配置文件流程,并最终获得了组织者和目标的构建配置来识别它。

问题是,当在“Distribution”上设置“Active Configuration”时(按照 iPhone 开发中心的说明,“Release”配置的重复),我无法编译代码。该项目包含对静态库的引用,该静态库包含多个类,这些类在项目的许多类中用作基类。因此,在分发配置上构建时,编译器会抛出错误,指出无法从静态库中找到基类,并且构建失败。

如果我切换活动配置。到“调试”(如开发中使用的)完全没有问题,并且应用程序按预期正确编译。

我无法找出问题所在。我在这里发现了另一个类似的问题,但似乎是不同的情况:

iPhone 静态库分发和发布构建错误(但不适用于调试)

Google 似乎也没有很多有用的结果。我还在“构建”部分检查了目标的信息,并在“调试”和“分发”配置之间来回切换以检查是否有任何相关差异,但到目前为止还没有发现任何差异。实际上我没有找到有关静态库的任何相关信息。仅在信息窗口的常规选项卡上,但静态库在直接依赖项中正确显示。

所以,在这一点上我毫无头绪。我已尝试尽可能严格地遵循说明,但我想这还不够,我现在遇到了问题。我想修复应该有点简单(也许只是在某个地方设置一些参数),但是我还没有找到答案。

您能否(请:))提供一些帮助。任何帮助或提示,我们将不胜感激。

先感谢您!

I am currently trying to build the distribution product of my (first) iphone app so that it can be uploaded to the App Store. I have gone through all of the App ID and Distribution Provisioning profile process and finally got the Organizer and target's build configuration to recognize it.

The problem is that when setting the "Active Configuration" on "Distribution" (duplicate of the "Release" config. per iPhone Dev Center directions) I cannot get the code to compile. The project contains a reference to a static library which contains several classes that are used as base classes in many of the project's classes. So when building on Distribution configuration, the compiler throws errors saying that it cannot find the base classes from the static library, and the build fails.

If I switch the Active Config. to "Debug" (as used on development) there is no problem at all, and the app compiles correctly as expected.

I cannot get to find what the problem might be. I found this another similar question here but it seems to be a different case:

iPhone static library distribution and release build errors (but not for debug)

Google also seems not to have many useful results. I have also checked the target's info in the Build section, and switched back and forth between "Debug" and "Distribution" configurations to check for any relevant difference, but no one is found so far. Actually I didn't find any relevant info on the static lib. Only on the General Tab of the info window, but the static lib is displayed correctly in the Direct Dependencies.

So, at this point I am clueless. I have tried to follow the instructions as exactly as possible, but I guess that was not enough and I am having problems now. I suppose the fix should be somewhat simple (maybe just set some parameter, somewhere) however I have not been able to find that out.

Could you please (PLEASE :) ) provide some help on this. Any help or hint, is greatly appreciated.

Thank you in advance!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

情未る 2024-08-11 23:55:29

如下:

要进行分发构建,(按照 iPhone 开发中心的指示),您必须复制“发布”配置并将其命名为“分发”,然后在此活动配置下构建项目。检查目标信息窗口中的调试和分发配置的“标头搜索路径”,我注意到该值存在差异,该值设置为(对于这两个配置):

${BUILD_STYLE}-${PLATFORM_NAME}/usr/local/包含

,从而导致每个配置的 ${BUILD_STYLE}-${PLATFORM_NAME} 被替换为“Debug-iphoneos”和“Distribution-iphoneos”。静态库中的所有基类都存储在“include”文件夹中,但是没有“Distribution-iphoneos”文件夹。

这是因为我没有在静态库项目中添加“分发”配置,就像我在主应用程序的项目中所做的那样(我不知道我必须这样做)。所以为了解决这个问题,我只添加了相同的配置。在静态库项目中并构建它。

总之,如果您在使用引用的静态库中的类的项目中添加新配置,则还要在静态库项目中添加相同的配置并执行构建。这样主项目就能够找到基类。

也许这实际上是基本的东西,抱歉我只是在学习语言(和 XCode):)。

希望这会有所帮助,再次感谢亚历克斯。

问候

Here it is:

To make the distribution build, (per iPhone Dev Center directions) you have to make a copy of the "Release" configuration and name it as "Distribution", and then build the project under this Active Configuration. Checking the "Header Search Paths" in the target's info window for Debug and Distribution configs, I noticed a difference in the value, which was set as (for both configs):

${BUILD_STYLE}-${PLATFORM_NAME}/usr/local/include

so that resulted in ${BUILD_STYLE}-${PLATFORM_NAME} being replaced with "Debug-iphoneos" and "Distribution-iphoneos" for each config. All the base classes from the static lib were stored in the "include" folder, however there was not a "Distribution-iphoneos" folder.

This was because I did not add a "Distribution" configuration in the static lib project, as I did in the main app's project (I didn't know I had to). So to fix the problem, I only added the same config. in the static lib project and built it.

So in summary, if you add a new config in a project that uses classes from a referenced static lib, also add that same config in the static lib project and perform a build. This way the main project will be able to find the base classes.

Maybe this is actually basic stuff, sorry I am just learning the language (and XCode) :).

Hope this helps, thanks to Alex again.

Regards

﹏雨一样淡蓝的深情 2024-08-11 23:55:29

检查调试配置的构建选项;例如,调试配置的标头搜索路径可能与分发配置的标头搜索路径不同。选择菜单Project >编辑项目设置并输入:标题搜索路径以检查列出的配置的这些设置。如果配置之间存在差异,请将两者设置为相同。

Check the build options for the Debug configuration; for example, header search paths for the Debug configuration may be different than for the Distribution configuration. Select the menus Project > Edit Project Settings and type: Header Search Paths to check those settings for the listed Configuration. If something is different between configurations, make them the same for both.

静赏你的温柔 2024-08-11 23:55:29

我听说过 iPhone OS 3.0 SDK 的链接器问题;一些解决方法包括在构建项目时将 -all_load 添加到链接器标志(尽管这可能会产生意想不到的副作用)。另一种选择是升级到 3.1 SDK,我相信这些问题已经得到解决。当然,这可能根本不是您的问题...

其他寻求帮助的地方:

I have heard of linker issues with the iPhone OS 3.0 SDK; Some of the workarounds include adding -all_load to the linker flags when building your project (though this could have unintended side effects). Another option is to upgrade to the 3.1 SDK, where I believe these issues have been resolved. Of course, this might not be your problem at all...

Other places for help:

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文