使用 phonegap v 2.9 为 Xcode 4.6 版本构建存档失败

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

Building an archive for Xcode 4.6 release with phonegap v 2.9 fails

iosxcodearchitecturecordovaphonegap-build

提问by lekash

This appears to be a recurring phenomena.

这似乎是一个反复出现的现象。

I saw a number of prior questions, where the solution was to delete armv6, and then the archive would work. Of course, armv6 is gone.

我看到了一些之前的问题,解决方案是删除 armv6,然后存档就可以工作了。当然,armv6 没有了。

So, now, building with both current, Xcode 4.6.3 phonegap 2.9.And yes, the app works fine on iphones, ipads, and in the simulator.

所以,现在,使用当前的Xcode 4.6.3 phonegap 2.9 构建。是的,该应用程序在 iphone、ipad 和模拟器上运行良好。

I get this message at the end of the create archive step:

我在创建存档步骤结束时收到此消息:

    /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang -arch armv7s -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS6.1.sdk -L/Users/peeq/Library/Developer/Xcode/DerivedData/peeq-gylybvwifdxjmtajtbvdsdpjcvkl/Build/Intermediates/ArchiveIntermediates/peeq/BuildProductsPath/Release-iphoneos -F/Users/peeq/Library/Developer/Xcode/DerivedData/peeq-gylybvwifdxjmtajtbvdsdpjcvkl/Build/Intermediates/ArchiveIntermediates/peeq/BuildProductsPath/Release-iphoneos -filelist /Users/peeq/Library/Developer/Xcode/DerivedData/peeq-gylybvwifdxjmtajtbvdsdpjcvkl/Build/Intermediates/ArchiveIntermediates/peeq/IntermediateBuildFilesPath/peeq.build/Release-iphoneos/peeq.build/Objects-normal/armv7s/peeq.LinkFileList -dead_strip -weak_framework CoreFoundation -weak_framework UIKit -weak_framework AVFoundation -weak_framework CoreMedia -weak-lSystem -force_load /Users/peeq/Library/Developer/Xcode/DerivedData/peeq-gylybvwifdxjmtajtbvdsdpjcvkl/Build/Intermediates/ArchiveIntermediates/peeq/InstallationBuildProductsLocation/Applications/libCordova.a -ObjC -fobjc-link-runtime -miphoneos-version-min=5.0 -framework CoreLocation -framework ImageIO -framework OpenAL -framework AssetsLibrary /Users/peeq/Library/Developer/Xcode/DerivedData/peeq-gylybvwifdxjmtajtbvdsdpjcvkl/Build/Intermediates/ArchiveIntermediates/peeq/BuildProductsPath/Release-iphoneos/libCordova.a -framework Foundation -weak_framework UIKit -framework CoreGraphics -framework AddressBook -framework AddressBookUI -framework AudioToolbox -weak_framework AVFoundation -framework CFNetwork -framework MediaPlayer -framework QuartzCore -framework SystemConfiguration -framework MobileCoreServices -weak_framework CoreMedia -framework CoreLocation -o /Users/peeq/Library/Developer/Xcode/DerivedData/peeq-gylybvwifdxjmtajtbvdsdpjcvkl/Build/Intermediates/ArchiveIntermediates/peeq/IntermediateBuildFilesPath/peeq.build/Release-iphoneos/peeq.build/Objects-normal/armv7s/peeq

ld: file not found: /Users/peeq/Library/Developer/Xcode/DerivedData/peeq-gylybvwifdxjmtajtbvdsdpjcvkl/Build/Intermediates/ArchiveIntermediates/peeq/InstallationBuildProductsLocation/Applications/libCordova.a
clang: error: linker command failed with exit code 1 (use -v to see invocation)

And went over and looked around the file system there:

然后走过去环顾那里的文件系统:

cd /Users/peeq/Library/Developer/Xcode/DerivedData/peeq-gylybvwifdxjmtajtbvdsdpjcvkl/Build
./Intermediates/ArchiveIntermediates/peeq/BuildProductsPath/Release-iphoneos/libCordova.a
./Intermediates/ArchiveIntermediates/peeq/IntermediateBuildFilesPath/CordovaLib.build/Release-iphoneos/CordovaLib.build/Objects-normal/armv7/libCordova.a
./Intermediates/ArchiveIntermediates/peeq/IntermediateBuildFilesPath/CordovaLib.build/Release-iphoneos/CordovaLib.build/Objects-normal/armv7s/libCordova.a
./Intermediates/ArchiveIntermediates/peeq/IntermediateBuildFilesPath/UninstalledProducts/libCordova.a

And it's been built, just not put where the linker wanted to find it.

它已经构建好了,只是没有放在链接器想要找到的地方。

So, no doubt some build setting either tells the linker to look there, or tells the build to put it where the linker wants to find it.

因此,毫无疑问,某些构建设置要么告诉链接器在那里查看,要么告诉构建将它放在链接器想要找到的位置。

Unless it's something else.

除非是别的东西。

My question is how to get the app archive to build correctly, so it can go off to the store.

我的问题是如何正确构建应用程序存档,以便它可以发送到商店。



A fine person who works at Apple told me where to look, at which point, this was solved.

一位在 Apple 工作的好人告诉我在哪里看,到那时,这个问题就解决了。

Deep within the Build Settings, there is a field to be set, called Other Linker Flags

在 Build Settings 的深处,有一个字段需要设置,称为 Other Linker Flags

It starts out showing no value, but if you click on it, it pops up with Debug and Release.

它开始时没有显示任何值,但是如果您单击它,它会弹出 Debug 和 Release。

In the very long string that is Release, one finds a -force_load libCordova.a
and deletes that part of the string.

在很长的 Release 字符串中,找到一个 -force_load libCordova.a
并删除该部分字符串。

From:

从:

-weak_framework CoreFoundation -weak_framework UIKit -weak_framework AVFoundation -weak_framework CoreMedia -weak-lSystem -force_load ${TARGET_BUILD_DIR}/libCordova.a -ObjC

To:

到:

-weak_framework CoreFoundation -weak_framework UIKit -weak_framework AVFoundation -weak_framework CoreMedia -weak-lSystem  -ObjC

Its probably a bug in some fashion that phonegap defaults this in place, I shall also contact them and see if it can default repair it.

它可能是某种方式的错误,phonegap 将其默认设置到位,我也会联系他们,看看它是否可以默认修复它。

His note that pointed me at it:

他指出我的笔记:

I notice that your link command contains both this:

我注意到您的链接命令包含以下两个内容:

-force_load /Users/peeq/Library/Developer/Xcode/DerivedData/peeq-gylybvwifdxjmtajtbvdsdpjcvkl/Build/Intermediates/ArchiveIntermediates/peeq/InstallationBuildProductsLocation/Applications/libCordova.a

and this:

和这个:

/Users/peeq/Library/Developer/Xcode/DerivedData/peeq-gylybvwifdxjmtajtbvdsdpjcvkl/Build/Intermediates/ArchiveIntermediates/peeq/BuildProductsPath/Release-iphoneos/libCordova.a

The path being passed to -force_load is the bogus path that the linker is complaining about. I think that you need to remove the “-force_load” linker flag. Do you have such a flag set in the “Other Linker Flags” setting?

传递给 -force_load 的路径是链接器抱怨的虚假路径。我认为您需要删除“-force_load”链接器标志。您是否在“其他链接器标志”设置中设置了这样的标志?

回答by Shazron

Found a fix.

找到了解决办法。

  1. In your Target's Build Settings, find Other Linker Flags
  2. Change $(TARGET_BUILD_DIR)/libCordova.a
  3. To $(BUILT_PRODUCTS_DIR)/libCordova.a
  1. 在目标的构建设置中,找到 Other Linker Flags
  2. 改变 $(TARGET_BUILD_DIR)/libCordova.a
  3. $(BUILT_PRODUCTS_DIR)/libCordova.a

回答by Jirawat Akkanit

It's does not works for me to change to "$(BUILT_PRODUCTS_DIR)/libCordova.a" in "Other Linker Flags". The problem still exist. (Xcode 4.6.3 phonegap 2.9.0)

在“其他链接器标志”中更改为“$(BUILT_PRODUCTS_DIR)/libCordova.a”对我来说不起作用。问题仍然存在。(Xcode 4.6.3 phonegap 2.9.0)

So, I try the setting below and it works for me.

所以,我尝试了下面的设置,它对我有用。

  1. In your Target's Build Settings, find "Other Linker Flags"
  2. Delete "$(TARGET_BUILD_DIR)/libCordova.a"
  3. Change "-force_load" to "-all_load"
  1. 在目标的构建设置中,找到“其他链接器标志”
  2. 删除“$(TARGET_BUILD_DIR)/libCordova.a”
  3. 将“-force_load”更改为“-all_load”

This did the trick for me.

这对我有用。

======== Update ============

======== 更新 ============

With the above trick, I can achieve the app and submit to App Store with no issue. But I found out in the iTune Connect that it shows "Invalid binary".

使用上述技巧,我可以实现应用程序并毫无问题地提交到 App Store。但是我在 iTune Connect 中发现它显示“无效的二进制文件”。