XCode 6.0.1 上的 Apple Mach-O 链接器错误

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

Apple Mach-O Linker Error on XCode 6.0.1

iosxcodecordovaxcode6linker-errors

提问by Prabakaran Raja

I have updated my XCode to 6.0.1 Before this update, I was able to build my project in both simulator and in my device. But now, it is giving me Apple Mach-O Linker Error

我已将 XCode 更新为 6.0.1 在此更新之前,我能够在模拟器和设备中构建我的项目。但是现在,它给了我Apple Mach-O 链接器错误

I surfed a lot. I have deleted the DerivedData folder. Still having the Problem.

我冲浪了很多。我已经删除了 DerivedData 文件夹。仍然有问题。

I am building a Phonegap App. Please help me.

我正在构建一个 Phonegap 应用程序。请帮我。

Undefined symbols for architecture arm64:
  "_OBJC_CLASS_$_CDVWebViewDelegate", referenced from:
      objc-class-ref in CDVInAppBrowser.o
  "_OBJC_CLASS_$_CDVInvokedUrlCommand", referenced from:
      objc-class-ref in CDVContacts.o
      objc-class-ref in CDVFile.o
  "_OBJC_METACLASS_$_CDVViewController", referenced from:
      _OBJC_METACLASS_$_MainViewController in MainViewController.o
  "_OBJC_CLASS_$_CDVPlugin", referenced from:
      _OBJC_CLASS_$_CDVLogger in CDVLogger.o
      _OBJC_CLASS_$_CDVContacts in CDVContacts.o
      _OBJC_CLASS_$_CDVDevice in CDVDevice.o
      _OBJC_CLASS_$_CDVNotification in CDVNotification.o
      _OBJC_CLASS_$_CDVFile in CDVFile.o
      _OBJC_CLASS_$_CDVFileTransfer in CDVFileTransfer.o
      _OBJC_CLASS_$_CDVInAppBrowser in CDVInAppBrowser.o
      ...
  "_OBJC_METACLASS_$_CDVPlugin", referenced from:
      _OBJC_METACLASS_$_CDVLogger in CDVLogger.o
      _OBJC_METACLASS_$_CDVContacts in CDVContacts.o
      _OBJC_METACLASS_$_CDVDevice in CDVDevice.o
      _OBJC_METACLASS_$_CDVNotification in CDVNotification.o
      _OBJC_METACLASS_$_CDVFile in CDVFile.o
      _OBJC_METACLASS_$_CDVFileTransfer in CDVFileTransfer.o
      _OBJC_METACLASS_$_CDVInAppBrowser in CDVInAppBrowser.o
      ...
  "_OBJC_CLASS_$_CDVViewController", referenced from:
      _OBJC_CLASS_$_MainViewController in MainViewController.o
      objc-class-ref in CDVDevice.o
      objc-class-ref in CDVFile.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 CDVContacts.o
      objc-class-ref in CDVDevice.o
      objc-class-ref in CDVNotification.o
      objc-class-ref in CDVFile.o
      objc-class-ref in CDVLocalFilesystem.o
      objc-class-ref in CDVAssetLibraryFilesystem.o
      objc-class-ref in CDVFileTransfer.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 Manthan

This kind of problems generally 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 。

If this does not work then try to remove armv7salso.

如果这不起作用,那么也尝试删除armv7s

Please check all your frameworks are linked properly and referenced. Try to remove and add again the frameworks for that third party tool.

请检查您的所有框架是否正确链接和引用。尝试删除并再次添加该第三方工具的框架。

Please check all the frameworks are properly referenced.

请检查所有框架都被正确引用。

In my case this worked for me.

就我而言,这对我有用。

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

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

Hope it helps you.

希望对你有帮助。

回答by norman784

I found the solution, isn't a monkey patch, its a correction of the project. What we need to do its to change the architectures supported by the application:

我找到了解决方案,不是猴子补丁,而是对项目的更正。我们需要做的是改变应用程序支持的架构:

  1. Go to Project -> Build Settings (check to see "all") -> Architectures -> Standard architectures (armv7 armv7s arm64)
  2. Go to Cordoba lib project -> Build Settings (check to see "all") -> Architectures:
    • Open the Debug tree and remove all elements inside them
    • Open the Release tree and do the same
  3. Go to Cordoba lib project (select target this time)and do the same of the step 2
  1. 转到项目-> 构建设置(检查以查看“全部”)-> 架构-> 标准架构(armv7 armv7s arm64)
  2. 转到Cordoba lib 项目 -> 构建设置(检查以查看“全部”)-> 架构
    • 打开调试树并删除其中的所有元素
    • 打开发布树并执行相同操作
  3. 转到Cordoba lib 项目(这次选择目标)并执行步骤 2 的相同操作

See the youtube videofor detailed information.

有关详细信息,请参阅YouTube 视频

回答by Smashing

You can remove 64bit support as Manthan said, but for app store compliance (starting 1 February 2015) you do need it. I would suggest starting the process of updating all your Frameworks etc. to versions which do support 64bit.

您可以像 Manthan 所说的那样删除 64 位支持,但为了应用商店合规性(从 2015 年 2 月 1 日开始),您确实需要它。我建议开始将所有框架等更新到支持 64 位的版本的过程。

From what I have seen and experienced, using Cocoapodsis the easiest route to follow as it is really easy to control your framework version and update as well as downgrade to other versions. I would suggest finding out what your current versions of frameworks are and slowly updating them from there, until you find a version with 64 bit support which works with your current build.

从我所见所闻,使用Cocoapods是最容易遵循的途径,因为它非常容易控制您的框架版本和更新以及降级到其他版本。我建议找出您当前版本的框架,然后从那里慢慢更新它们,直到您找到一个支持 64 位且适用于您当前构建的版本。

Another method that I have found which usually fixes mach-o errors are the following:

我发现的另一种通常可以修复 mach-o 错误的方法如下:

  • Make sure that Target => Architectures => Build Active Architecturesis set to NO.
  • Make sure Target => Search Paths => Framework search paths, and Library search pathshas $(inherited)as their first entry.
  • 确保Target => Architectures => Build Active Architectures设置为 NO。
  • 确保Target => Search Paths => Framework search pathsLibrary search paths$(inherited)作为他们的第一个条目。

Converting to 64bit can be a really daunting task, but will probably be worth it in the long run.

转换为 64 位可能是一项非常艰巨的任务,但从长远来看可能是值得的。

回答by Prabakaran Raja

I uninstalled the whole XCode 6. I updated the phonegap in my mac and reinstalled it again. Created a new phonegap project. Copied the code (www folder) into the new project. Build it. And it is working fine in XCode 6.

我卸载了整个 XCode 6。我更新了我的 mac 中的 phonegap 并重新安装了它。创建了一个新的 phonegap 项目。将代码(www 文件夹)复制到新项目中。建造它。它在 XCode 6 中运行良好。

Sorry for the delayed reply

抱歉回复延迟

回答by adnan

I got the same issue when I imported some git project, finally found the solution in changing the Development target.

我在导入一些git项目时遇到了同样的问题,最终在更改开发目标中找到了解决方案。

go to Project->General->Development Info and change Deployment target.

转到 Project->General->Development Info 并更改部署目标。