gpt4 book ai didi

ios - Cocoapod 库问题 : DTCoreText

转载 作者:行者123 更新时间:2023-11-29 12:22:40 24 4
gpt4 key购买 nike

我之前就这个问题提出了一个问题,但我已经清理了项目并从头开始重新启动。

我正在尝试使用 DTCoreText

  1. 我的播客文件:
platform :iOS
pod 'DTCoreText'

^quote 因为出于某种原因编辑器不让我把代码放在那里。

  1. 其他链接器标志:-OjbC -all_load

  2. Linked Frameworks

  3. Project

我得到一长串错误:

Undefined symbols for architecture x86_64:
"_htmlCreatePushParserCtxt", referenced from:
-[DTHTMLParser parse] in libPods-DTFoundation.a(DTHTMLParser.o)
"_htmlCtxtUseOptions", referenced from:
-[DTHTMLParser parse] in libPods-DTFoundation.a(DTHTMLParser.o)
"_htmlFreeParserCtxt", referenced from:
-[DTHTMLParser dealloc] in libPods-DTFoundation.a(DTHTMLParser.o)
"_htmlParseDocument", referenced from:
-[DTHTMLParser parse] in libPods-DTFoundation.a(DTHTMLParser.o)
"_xmlDetectCharEncoding", referenced from:
-[DTHTMLParser parse] in libPods-DTFoundation.a(DTHTMLParser.o)
"_xmlParseCharEncoding", referenced from:
-[DTHTMLParser parse] in libPods-DTFoundation.a(DTHTMLParser.o)
"_xmlSAX2GetColumnNumber", referenced from:
-[DTHTMLParser columnNumber] in libPods-DTFoundation.a(DTHTMLParser.o)
"_xmlSAX2GetLineNumber", referenced from:
-[DTHTMLParser lineNumber] in libPods-DTFoundation.a(DTHTMLParser.o)
"_xmlSAX2GetPublicId", referenced from:
-[DTHTMLParser publicID] in libPods-DTFoundation.a(DTHTMLParser.o)
"_xmlSAX2GetSystemId", referenced from:
-[DTHTMLParser systemID] in libPods-DTFoundation.a(DTHTMLParser.o)
"_xmlSAX2InitHtmlDefaultSAXHandler", referenced from:
-[DTHTMLParser initWithData:encoding:] in libPods-DTFoundation.a(DTHTMLParser.o)
"_xmlStopParser", referenced from:
-[DTHTMLParser abortParsing] in libPods-DTFoundation.a(DTHTMLParser.o)
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)

这是我第一次尝试使用 Cocoapod,我可能在这里犯了一个菜鸟错误


如果我从项目运行的链接框架中删除 DTFoundation.a 和 DTCoreText.a,但出现以下错误:

-[NSConcreteMutableAttributedString initWithHTMLData:documentAttributes:]: unrecognized selector sent to instance 

使用他们的示例代码:

#import "DTCoreText.h"

NSString *html = @"<p>Some Text</p>";
NSData *data = [html dataUsingEncoding:NSUTF8StringEncoding];

NSAttributedString *attrString = [[NSAttributedString alloc] initWithHTMLData:data
documentAttributes:NULL];
NSLog(@"%@", attrString);

当我使用 Jon Suggested 的 podfile 更新并删除旧的配置/链接器标志时,我收到此错误:

[!] The `**** [Debug]` target overrides the `OTHER_LDFLAGS` build setting defined in `Pods/Target Support Files/Pods-****/Pods-****.debug.xcconfig'. This can lead to problems with the CocoaPods installation
- Use the `$(inherited)` flag, or
- Remove the build settings from the target.

[!] The `**** [Release]` target overrides the `OTHER_LDFLAGS` build setting defined in `Pods/Target Support Files/Pods-****/Pods-****.release.xcconfig'. This can lead to problems with the CocoaPods installation
- Use the `$(inherited)` flag, or
- Remove the build settings from the target.

如何重置这些?或者有没有办法告诉它无论如何都要覆盖它?

最佳答案

“在我的机器上工作。”™

您使用的是最新的 CocoaPods 吗? 0.37.1 是最新的,您应该使用它,除非您有特殊原因不这样做。

这个 Podfile 对我来说工作得很好(通过在项目目录中运行 pod init 生成):

platform :ios, '8.3'

target 'DTCoreTextTest' do
pod 'DTCoreText'
end

target 'DTCoreTextTestTests' do

end

无需添加额外的 -ObjC-all_load 标志。

关于ios - Cocoapod 库问题 : DTCoreText,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30148461/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com