xcode 为什么我的应用程序突然无法构建并抱怨这些“ld”和“clang”错误?

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

Why does my app suddenly not build and complain about these "ld" and "clang" errors?

iosobjective-cxcodeclangld

提问by Doug Smith

These errors are really confusing me, and I have no idea what I did to trigger them:

这些错误真的让我很困惑,我不知道我做了什么来触发它们:

ld: warning: directory not found for option '-F/"..."'
ld: warning: ignoring file "..."/iOS 7/Crashlytics.framework/Crashlytics, file was built for unsupported file format ( 0x56 0x65 0x72 0x73 0x69 0x6F 0x6E 0x73 0x2F 0x43 0x75 0x72 0x72 0x65 0x6E 0x74 ) which is not the architecture being linked (i386): /"..."/Crashlytics.framework/Crashlytics
Undefined symbols for architecture i386:
  "_OBJC_CLASS_$_Crashlytics", referenced from:
      objc-class-ref in AppDelegate.o
ld: symbol(s) not found for architecture i386
clang: error: linker command failed with exit code 1 (use -v to see invocation)

I haven't a sweet clue what it is talking about. How do I fix it?

我不知道它在说什么。我如何解决它?

采纳答案by Guilherme Torres Castro

The version of the framwork you are linking to the project is build only for Device. Use fabric desktop application to link the correct framework to your project.

您链接到项目的框架版本仅为设备构建。使用结构桌面应用程序将正确的框架链接到您的项目。

回答by capikaw

From Crashlytics support:

来自 Crashlytics 的支持:

  1. Trash Crashlytics.framework from your project.

  2. Run this in the terminal to copy the framework to your desktop:

  1. 从您的项目中删除 Crashlytics.framework。

  2. 在终端中运行它以将框架复制到您的桌面:

ditto -xk /Applications/Fabric.app/Contents/Resources/com.crashlytics.sdk.ios-default.zip ~/Desktop/

同上 -xk /Applications/Fabric.app/Contents/Resources/com.crashlytics.sdk.ios-default.zip ~/Desktop/

  1. Add & copy the framework back into your project.
  1. 将框架添加并复制回您的项目。

回答by Tim

I was using Crashlytics with cocoapods and confronted the same error after upgrading to Fabric.

我将 Crashlytics 与 cocoapods 一起使用,并在升级到 Fabric 后遇到了同样的错误。

Steps to fix:

修复步骤:

  1. Delete "Other linker flags" and paste $(inherited) in it
  2. Delete "Other librarian flags" and paste $(OTHER_LDFLAGS)
  3. Delete Crashlytics.framework from the Pods directory
  4. Run pod install. You will see something like this in the "./Pods/Fabric/Crashlytics.framework/Versions/A/Resources/info.plist
  1. 删除“其他链接器标志”并在其中粘贴 $(inherited)
  2. 删除“其他图书馆员标志”并粘贴 $(OTHER_LDFLAGS)
  3. 从 Pods 目录中删除 Crashlytics.framework
  4. 运行 pod 安装。您将在“./Pods/Fabric/Crashlytics.framework/Versions/A/Resources/info.plist

enter image description here

在此处输入图片说明