Xcode 5和phonegap:构build设备上的链接器错误,但不适用于模拟器

我们的phonegap应用程序适用于iPhone模拟器,但在iPhone上构build应用程序时会产生链接器错误。 唯一改变的是安装testflight和一个testing应用程序。

我们已经删除了testflight和testing应用程序,但链接器错误依然存在。

有想法该怎么解决这个吗?

我们在Xcode 5和手机3.4。

错误:

ld: warning: ignoring file /Users/c/Library/Developer/Xcode/DerivedData/s-fhgxmhdprdjvwahdbgwuagoragit/Build/Products/Debug-iphoneos/libCordova.a, file was built for archive which is not the architecture being linked (arm64): /Users/c/Library/Developer/Xcode/DerivedData/s-fhgxmhdprdjvwahdbgwuagoragit/Build/Products/Debug-iphoneos/libCordova.a Undefined symbols for architecture arm64: "_OBJC_CLASS_$_CDVWebViewDelegate", referenced from: objc-class-ref in CDVInAppBrowser.o "_OBJC_METACLASS_$_CDVViewController", referenced from: _OBJC_METACLASS_$_MainViewController in MainViewController.o "_OBJC_CLASS_$_CDVPlugin", referenced from: _OBJC_CLASS_$_CDVDevice in CDVDevice.o _OBJC_CLASS_$_CDVConnection in CDVConnection.o _OBJC_CLASS_$_LowLatencyAudio in LowLatencyAudio.o _OBJC_CLASS_$_CDVLogger in CDVLogger.o _OBJC_CLASS_$_CDVInAppBrowser in CDVInAppBrowser.o _OBJC_CLASS_$_InAppPurchase in InAppPurchase.o "_OBJC_METACLASS_$_CDVPlugin", referenced from: _OBJC_METACLASS_$_CDVDevice in CDVDevice.o _OBJC_METACLASS_$_CDVConnection in CDVConnection.o _OBJC_METACLASS_$_LowLatencyAudio in LowLatencyAudio.o _OBJC_METACLASS_$_CDVLogger in CDVLogger.o _OBJC_METACLASS_$_CDVInAppBrowser in CDVInAppBrowser.o _OBJC_METACLASS_$_InAppPurchase in InAppPurchase.o "_OBJC_CLASS_$_CDVViewController", referenced from: _OBJC_CLASS_$_MainViewController in MainViewController.o objc-class-ref in CDVDevice.o "_CDVLocalNotification", referenced from: -[AppDelegate application:didReceiveLocalNotification:] in AppDelegate.o "_OBJC_METACLASS_$_CDVCommandDelegateImpl", referenced from: _OBJC_METACLASS_$_MainCommandDelegate in MainViewController.o "_OBJC_CLASS_$_CDVPluginResult", referenced from: objc-class-ref in CDVDevice.o objc-class-ref in CDVConnection.o objc-class-ref in LowLatencyAudio.o objc-class-ref in CDVInAppBrowser.o objc-class-ref in InAppPurchase.o "_OBJC_CLASS_$_CDVCommandDelegateImpl", referenced from: _OBJC_CLASS_$_MainCommandDelegate in MainViewController.o "_OBJC_CLASS_$_CDVUserAgentUtil", referenced from: objc-class-ref in CDVInAppBrowser.o "_OBJC_CLASS_$_CDVCommandQueue", referenced from: _OBJC_CLASS_$_MainCommandQueue in MainViewController.o "_OBJC_METACLASS_$_CDVCommandQueue", referenced from: _OBJC_METACLASS_$_MainCommandQueue in MainViewController.o "_CDVPluginHandleOpenURLNotification", referenced from: -[AppDelegate application:handleOpenURL:] in AppDelegate.o -[CDVInAppBrowser openInSystem:] in CDVInAppBrowser.o ld: symbol(s) not found for architecture arm64 clang: error: linker command failed with exit code 1 (use -v to see invocation) 

在更新Xcode时会出现这种问题,但是您正在使用的任何第三方工具可能无法使用此架构armv64进行更新。

所以从XCode上点击你的Project Navigator。

从项目中点击Targets ,然后点击BuildSettings

在其中findValid Architectures

只需双击,并armv64删除armv64

确保只有armv7和armv7s

在我的情况下这对我有效。

清理并build立您的项目。 现在应该可以正常工作了。

希望它可以帮助你。

编辑

现在,截至2015年2月1日 ,苹果将不允许没有支持arm64体系结构的应用程序。

所以请确保所有提交的应用程序都支持arm64。

好像我们也无意中升级到了xcode 5.1,造成这个问题。 phonegap 3.4和xcode 5.1是不兼容的,除非你做一些改变。

这里是解决scheme: http : //shazronatadobe.wordpress.com/2014/03/12/xcode-5-1-and-cordova-ios/

对不起,如果这可能看起来像一个古怪的答案,但以下步骤通常是我总是看到链接器错误时做的:

  • 确保您的代码是最新的,包含所有最新的修补程序和版本。
  • 确保你更新你的子模块。 在git: git submodule update --init --recursive
  • 请做一个清洁的生成文件夹:转到产品,hover在清洁,并按(Command +选项),并点击“清洁生成文件夹”。

冲洗并重复。

如果你有任何不正确引用的模块,请转到你的构build阶段,删除困扰你的模块并重新添加它们。