xcode 解析和 Facebook SDK“Bolts”框架错误

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

Parse and Facebook SDK "Bolts" Framework error

xcodefacebookparse-platform

提问by mginn

I have an app with both the Parse and Facebook frameworks installed. Parse was installed by dragging the files to the "Frameworks" folder of the project and selecting "copy if needed", while the Facebook SDK was installed by dragging and not selecting the copy option. Both appear under the Linked Binaries list. The problem appears to be that Bolts is included in both SDKs. I tried just using the Facebook one, producing the following Link-O errors:

我有一个安装了 Parse 和 Facebook 框架的应用程序。Parse 是通过将文件拖动到项目的“Frameworks”文件夹并选择“如果需要复制”来安装的,而 Facebook SDK 是通过拖动而不选择复制选项来安装的。两者都出现在 Linked Binaries 列表下。问题似乎是 Bolts 包含在两个 SDK 中。我尝试只使用 Facebook 的,产生以下 Link-O 错误:

Undefined symbols for architecture x86_64:
  "_BFTaskMultipleExceptionsException", referenced from:
      ___53+[PFObject(Private) deleteAllAsync:withSessionToken:]_block_invoke214 in Parse(PFObject.o)
      ___65+[PFObject(Private) _deepSaveAsync:withCurrentUser:sessionToken:]_block_invoke311 in Parse(PFObject.o)
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)

I deleted the link to the Facebook one and tried dragging the Parse one, but the error persisted. I also got the warning that

我删除了 Facebook 的链接并尝试拖动 Parse 的链接,但错误仍然存​​在。我也收到警告

ld: warning: ignoring file /Users/milesper/Documents/FacebookSDK/Bolts.framework/Bolts, missing required architecture x86_64 in file /Users/milesper/Documents/FacebookSDK/Bolts.framework/Bolts (2 slices)

even though I had deleted the file from the Facebook SDK.

即使我已经从 Facebook SDK 中删除了该文件。

How should I clean up the project and link to the Parse version of Bolts? Is there something else i should be doing?

我应该如何清理项目并链接到 Bolts 的 Parse 版本?还有什么我应该做的吗?

采纳答案by mginn

Well I found it. The problem was that old files (which were now deleted) were being referenced in the "Library Search Paths Flag". Thanks to this postfor giving me the idea. All I had to do was delete the old paths and it now works again.

嗯,我找到了。问题是在“库搜索路径标志”中引用了旧文件(现在已删除)。感谢这篇文章给了我这个想法。我所要做的就是删除旧路径,现在它又可以工作了。

EDIT: It appears that for some situations the order of the search paths matters as well (see below).

编辑:在某些情况下,搜索路径的顺序似乎也很重要(见下文)。

回答by stone

Turns out the order in which you include/search the frameworks in your project matters.

事实证明,您在项目中包含/搜索框架的顺序很重要。

Here is what I did to work with Parse 1.6.4 and FacebookSDK without CacoaPods

这是我在没有 CacoaPods 的情况下使用 Parse 1.6.4 和 FacebookSDK 所做的工作

  1. Use the latest version of Bolts. (1.1.4)
  2. Your include paths should be ordered to find Bolt first, then FacebookSDK, then Parse
  1. 使用最新版本的螺栓。(1.1.4)
  2. 你的包含路径应​​该先找到 Bolt,然后是 FacebookSDK,然后是 Parse

Ordering your search paths

排序搜索路径

回答by Jo?l

That worked for me Temporary workaround for Parse 1.6.4 and Facebook SDK 3.23

这对我有用 Parse 1.6.4 和 Facebook SDK 3.23 的临时解决方法

Add to your AppDelegate.m or another class following constant after imports and before implementation section: NSString *const BFTaskMultipleExceptionsException = @"BFMultipleExceptionsException";

在导入之后和实现部分之前添加到您的 AppDelegate.m 或其他类以下常量: NSString *const BFTaskMultipleExceptionsException = @"BFMultipleExceptionsException";

The explanation of the bug https://stackoverflow.com/a/29136507/1345244

bug的解释https://stackoverflow.com/a/29136507/1345244

One hack I found for working around missing symbols, was just redefining the missing symbol again in my code.

The BFTaskMultipleExceptionsException string is defined here like this:

NSString *const BFTaskMultipleExceptionsException = @"BFMultipleExceptionsException"; So maybe just try putting that one line into your code?

From the history on github, it looks like this was just added to Bolts about 19 days ago. Version 1.1.4 of Bolts was released 14 days ago (1.1.3 was from October last year). So it probably is caused by the version mismatch of Bolts that you noticed.

Another option might be to get an older version of Parse from before Bolts 1.1.4 was released.

Presumably this will be fixed once a new Facebook SDK is available with Bolts 1.1.4.

我发现的一种解决丢失符号的技巧,就是在我的代码中再次重新定义丢失的符号。

BFTaskMultipleExceptionsException 字符串在这里定义如下:

NSString *const BFTaskMultipleExceptionsException = @"BFMultipleExceptionsException"; 所以也许只是尝试将这一行放入您的代码中?

从 github 上的历史来看,这似乎是大约 19 天前才添加到 Bolts 中的。Bolts 1.1.4 版本在 14 天前发布(1.1.3 来自去年 10 月)。所以它可能是由您注意到的 Bolts 版本不匹配引起的。

另一种选择可能是在 Bolts 1.1.4 发布之前获取较旧版本的 Parse。

据推测,一旦新的 Facebook SDK 与 Bolts 1.1.4 一起可用,这个问题就会得到解决。

回答by SFWdc

same problem here.

同样的问题在这里。

I had both frameworks included with no problem, until I added SponsorPay SDK which needs to add the -ObjCin "Other Linker Flags" on target "Build Settings".

我有附带没有问题的两个框架,直到我说SponsorPay SDK这就需要添加-ObjC在“其它链接器标记”目标“构建设置”。

So, in my experience this issue only happens when the flag -ObjC is present.

因此,根据我的经验,此问题仅在存在标志 -ObjC 时发生。

I tried all the solutions exposed in here but nothing worked for me, I hope anyone can bring more light on how to solve this issue even with the -ObjC flag active.

我尝试了此处公开的所有解决方案,但没有任何效果对我有用,我希望即使 -ObjC 标志处于活动状态,任何人也能提供更多有关如何解决此问题的信息。

EDIT:

编辑:

There's a question related to this, I'll put the link here in case is helpful to someone: Contradicting frameworks on -ObjC

有一个与此相关的问题,我将链接放在这里以防对某人有帮助: -ObjC 上的矛盾框架

回答by alicanozkara

i had some issue, i just remove Parser.framework in Linked Framework and Librariesand work well.

我遇到了一些问题,我只是删除了链接框架和库中的 Parser.framework 并且运行良好。