Xcode 5和phonegap:构建设备但不是模拟器的链接器错误

时间:2014-03-19 01:42:55

标签: ios iphone xcode cordova armv7

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

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

有关如何解决此问题的任何想法?

我们正在使用xcode 5和phonegap 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)

3 个答案:

答案 0 :(得分:33)

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

所以点击XCode上的Project Navigator。

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

在其中找到Valid Architectures

只需双击它并从中删除armv64即可。

确保只有armv7和armv7s

就我而言,这对我有用。

清理并构建您的项目。它现在应该可以正常工作。

希望它对你有所帮助。

修改

现在,从 2015年2月1日开始,Apple将不允许不支持arm64架构的应用。

因此请确保提交的所有应用都支持arm64。

答案 1 :(得分:8)

似乎我们也无意中升级到xcode 5.1,导致问题。除非您进行一些更改,否则phonegap 3.4和xcode 5.1不兼容。

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

答案 2 :(得分:1)

很抱歉,如果这看起来像是一个陈腐的答案,但以下步骤通常是我在看到链接器错误时总是这样做的:

  • 确保您的代码是最新的,包含所有最新的修补程序和版本。
  • 确保更新子模块。在git中:git submodule update --init --recursive
  • 请执行Clean Build文件夹:转到产品,将鼠标悬停在Clean上并同时按下(Command + Option)并单击" Clean Build Folder"。

冲洗并重复。

如果您有任何未正确引用的模块,请转到Build Phase,删除困扰您的模块并重新添加它们。