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

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

Xcode 5 and phonegap: linker errors on building for device but not for simulator

iosiphonexcodecordovaarmv7

提问by Crashalot

Our phonegap app builds fine for the iphone simulator but generates linker errors when building the app on an iphone. the only thing that changed was installing testflight and a test app.

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

We already removed testflight and the test app, but the linker errors remain.

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

Any ideas on how to fix this?

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

We're on xcode 5 and phonegap 3.4.

我们使用的是 xcode 5 和 phonegap 3.4。

Errors:

错误:

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)

采纳答案by Crashalot

seems like we also unintentionally upgraded to xcode 5.1, causing the problem. phonegap 3.4 and xcode 5.1 are incompatible unless you make some changes.

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

here is the solution: http://shazronatadobe.wordpress.com/2014/03/12/xcode-5-1-and-cordova-ios/

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

回答by Manthan

This kind of problems occur while updating your Xcode but any third party tool you are using may not be updated with this architecture armv64.

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

So Click on your Project Navigator from XCode.

因此,从 XCode 单击您的项目导航器。

Click On Targetsfrom your Project and click on BuildSettingsfrom it.

单击“ Targets项目”中的“开”,然后单击“项目” BuildSettings

Find Valid Architecturesin it.

Valid Architectures在里面找。

Just double click on that and remove armv64from that.

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

Make sure there is armv7 and armv7sonly.

确保armv7s只有armv7 。

In my case this worked for me.

就我而言,这对我有用。

Clean and build your project. It should work fine now.

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

Hope it helps you.

希望对你有帮助。

EDIT

编辑

Now, as of Feb 1st 2015, apple will not allow apps without arm64 architecture supported.

现在,从2015 年 2 月 1 日起,苹果将不允许不支持 arm64 架构的应用程序。

So make sure that all the apps submitted have arm64 support.

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

回答by gran_profaci

Sorry if this might seem like a trite answer, but the following steps are usually what I always do when I see linker errors :

抱歉,这似乎是一个陈词滥调的答案,但是当我看到链接器错误时,通常会执行以下步骤:

  • Ensure your code is up to date, with all the latest fixes and versions.
  • Make sure you update your submodules. In git : git submodule update --init --recursive
  • Please do a Clean Build Folder : Go to Product, Hover on Clean and press together (Command + Option) and click on "Clean Build Folder".
  • 确保您的代码是最新的,具有所有最新的修复程序和版本。
  • 确保更新您的子模块。在 git 中:git submodule update --init --recursive
  • 请执行清理构建文件夹:转到产品,将鼠标悬停在清理上并按在一起(Command + Option),然后单击“清理构建文件夹”。

Rinse and Repeat.

冲洗并重复。

In case you have any modules that are not being references correctly, head over to your Build Phases, REMOVE the modules that are troubling you and re-add them.

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