首页 文章

导致此Crashlytics编译警告的原因是什么? (在'…'处自动链接提供的'…'框架链接器选项不是dylib)

提问于
浏览
52

编译我的主目标(不是像here这样的测试目标)会产生以下错误:

ld: warning: Auto-Linking supplied 
   '~/Documents/my_app/MyApp/Crashlytics.framework/Crashlytics', 
framework linker option at 
    ~/Documents/my_app/MyApp/Crashlytics.framework/Crashlytics 
is not a dylib

从这个构建命令:

Ld /Build/Products/Debug-iphonesimulator/MyApp.app/MyApp正常i386 cd~ / Documents / my_app / MyApp export IPHONEOS_DEPLOYMENT_TARGET = 8.0 export PATH =“/ Applications / Xcode.app / Contents / Developer / Platforms / iPhoneSimulator.platform /Developer/usr/bin:/Applications/Xcode.app/Contents/Developer/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin“/Applications/Xcode.app/Contents/Developer/Toolchains /XcodeDefault.xctoolchain/usr/bin/clang -arch i386 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator8.2.sdk -L~ / Library / Developer / Xcode / DerivedData / MyApp-dbmrsjmskpqxmnegayfzfxgcwvsm / Build / Products / Debug-iphonesimulator -F~ / Library / Developer / Xcode / DerivedData / MyApp-dbmrsjmskpqxmnegayfzfxgcwvsm / Build / Products / Debug-iphonesimulator -F~ / Documents / my_app / MyApp -filelist~ / Library / Developer / Xcode / DerivedData / MyApp-dbmrsjmskpqxmnegayfzfxgcwvsm / Build / Intermediates / MyApp.build / Debug-iphonesimulator / MyApp.build / Objects-normal / i386 / MyApp.LinkFileList -Xl inker -rpath -Xlinker @ executable_path / Frameworks -Xlinker -objc_abi_version -Xlinker 2 -ObjC -lPods-CocoaLumberjack -lPods-Mantle -framework CFNetwork -framework Foundation-framework Security -framework SystemConfiguration -fobjc-arc -fobjc-link-runtime -Xlinker -no_implicit_dylibs -mios-simulator-version-min = 8.0 -framework CoreGraphics -lPods -framework MapKit -framework Fabric -lPods-MyApp -Xlinker -dependency_info -Xlinker~ / Library / Developer / Xcode / DerivedData / MyApp-dbmrsjmskpqxmnegayfzfxgcwvsm / Build / Intermediates /MyApp.build/Debug-iphonesimulator/MyApp.build/Objects-normal/i386/MyApp_dependency_info.dat -o~ / Library / Developer / Xcode / DerivedData / MyApp-dbmrsjmskpqxmnegayfzfxgcwvsm / Build / Products / Debug-iphonesimulator / MyApp.app / MyApp的

6 回答

  • 5

    The Missing Link:

    这个错误几乎总是由于没有链接到库的二进制文件(在这种情况下它将是 Crashlytics.framework ):

    Link Fail

    尝试构建目标 MyApp (其中包含带 #import <Crashlytics/Crashlytics.h> 的标头将产生错误:

    ld:警告:自动链接在../../Crashlytics.framework/Crashlytics提供的'../../Crashlytics.framework/Crashlytics',框架链接器选项不是dylib

    Link the Framework:

    Link Success
    幸运的是,只需将 Crashlytics.framework 从项目导航器中的 Frameworks 文件夹拖到 Link Binary With Libraries 列表中或使用 + ,就可以轻松解决问题 .

    • 确保在执行此过程时在“目标”下选择/突出显示了应用程序 .

    enter image description here

  • 4

    我有同样的问题,但我的理由不同 .

    错误输出

    ld:警告:自动链接提供'〜/ GameFolder / Pods / Fabric / tvOS / Fabric.framework / Fabric',〜/ GameFolder / Pods / Fabric / tvOS / Fabric.framework / Fabric上的框架链接器选项不是dylib体系结构x86_64的未定义符号:“_ OBJC_CLASS _ $ _ Answers”,引自:GameScene.o中的__ObjC.Answers的类型元数据访问器类型AppDelegate.o中的__ObjC.Answers的元数据访问器“_OBJC_CLASS _ $ _ Crashlytics”,引自:type metadata accessor for AppDelegate.o中的__ObjC.Crashlytics“_OBJC_CLASS _ $ _ Fabric”,引用自:AppDelegate.o中的__ObjC.Fabric的类型元数据访问器ld:未找到架构x86_64 clang的符号:错误:链接器命令失败,退出代码为1(使用-v查看调用)

    原因

    • 我的目标超越了 OTHER_LDFLAGS .

    解决方案

    • OTHER_LDFLAGS 更改为仅继承链接器标志 . 基本上,改为 $(inherited)
  • 1

    我按照@i 'L'提供的所有步骤进行了操作,但是我无法在构建阶段找到 Crashlytics.frameworkFabric.framework 文件 .

    所以这对我有所帮助 .

    Step 1: 按照给出的所有步骤Here.

    Step 2: 现在,当您无法通过单击 + 找到 Link Binary With Libraries 中的 Crashlytics.frameworkFabric.framework 文件时,请执行以下操作 .

    2.1: 单击 Link Binary With Libraries 中的 + 按钮 .
    2.2: 单击 Add Other... 按钮 .
    2.3: 现在从 Pod 文件夹中选择 Crashlytic.frameworkFabric.framework - 如果使用cocoapods,则从下载文件中选择两个文件 .

    Step 3: Build 成功,享受 . :)

  • 1

    为了将来参考,如果您将测试文件链接到应用目标,也会发生这种情况 .

    例如:https://github.com/realm/realm-cocoa/issues/1661

  • 79

    我有同样的问题 . 也许我搞砸了最初的结构安装,但是一旦我将Fabric.framework添加到框架列表中(默认情况下应该在应用程序的根文件夹中)一切正常 .

  • 16

    与我提及的内容相反,问题也可能是你有 #import 语句不应该存在 .

    Xcode确实推断出要与 #import 语句链接的框架 . 如果导入未链接的框架,然后你得到这个警告 .

相关问题