xcode 是什么导致此 Crashlytics 编译警告?(自动链接在“...”处提供的“...”框架链接器选项不是 dylib)
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/29152442/
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
What is causing this Crashlytics compile warning? (Auto-Linking supplied '...' framework linker option at '...' is not a dylib)
提问by Robert
Compiling my main target (not a test target like here) yields this error:
编译我的主要目标(不是像这里这样的测试目标)会产生这个错误:
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
From this build command:
从这个构建命令:
Ld /Build/Products/Debug-iphonesimulator/MyApp.app/MyApp normal 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 -Xlinker -rpath -Xlinker @executable_path/Frameworks -Xlinker -objc_abi_version -Xlinker 2 -ObjC -lPods-CocoaLumberHyman -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
Ld /Build/Products/Debug-iphonesimulator/MyApp.app/MyApp normal 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-dbmrsjmskpqxmnegaysjmskpqxmnegayfzfxgcwvsm/Build/Products /Documents/my_app/MyApp -filelist ~/Library/Developer/Xcode/DerivedData/MyApp-dbmrsjmskpqxmnegayfzfxgcwvsm/Build/Intermediates/MyApp.build/Debug-iphonesimulator/MyApp.build/Objects-normal/i386/MyApp.LinkFileList -Xlinker rpath -Xlinker @executable_path/Frameworks -Xlinker -objc_abi_version -Xlinker 2 -ObjC -lPods-CocoaLumberHyman -lPods-Mantle -framework CFNetwork -framework Foundation -framework Security -framework SystemConfiguration -fobjc-arc -fobjc-link-runtime -Xlinkiter_ -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-MyApp. build/Objects-normal/i386/MyApp_dependency_info.dat -o ~/Library/Developer/Xcode/DerivedData/MyApp-dbmrsjmskpqxmnegayfzfxgcwvsm/Build/Products/Debug-iphonesimulator/MyApp.app/MyApp
回答by l'L'l
The Missing Link:
缺失的链接:
This error is almost always produced by not having the binary linked to the library (In this case it would be the Crashlytics.framework
):
这个错误几乎总是由于没有将二进制链接到库而产生的(在这种情况下,它将是Crashlytics.framework
):
Trying to build the target MyApp
(which includes headers with #import <Crashlytics/Crashlytics.h>
will produce the error:
尝试构建目标MyApp
(包括标头)#import <Crashlytics/Crashlytics.h>
将产生错误:
ld: warning: Auto-Linking supplied '../../Crashlytics.framework/Crashlytics', framework linker option at ../../Crashlytics.framework/Crashlytics is not a dylib
ld:警告:自动链接提供了“../../Crashlytics.framework/Crashlytics”,../../Crashlytics.framework/Crashlytics 中的框架链接器选项不是动态库
Link the Framework:
链接框架:
Fortunately, it should be easy to fix the problem simply by dragging the
Crashlytics.framework
from the Frameworks
folder in the project navigator into the list of Link Binary With Libraries
or by using the +
.
幸运的是,只需将项目导航器中
Crashlytics.framework
的Frameworks
文件夹中的拖放到 的列表中Link Binary With Libraries
或使用+
.
- Make sure you have your App selected/highlighted under Targets while doing this process.
- 确保在执行此过程时在目标下选择/突出显示您的应用程序。
回答by xemacobra
I had the same issue but my reason was different.
我有同样的问题,但我的原因不同。
Error Output
错误输出
ld: warning: Auto-Linking supplied '~/GameFolder/Pods/Fabric/tvOS/Fabric.framework/Fabric', framework linker option at ~/GameFolder/Pods/Fabric/tvOS/Fabric.framework/Fabric is not a dylib Undefined symbols for architecture x86_64: "_OBJC_CLASS_$_Answers", referenced from: type metadata accessor for __ObjC.Answers in GameScene.o type metadata accessor for __ObjC.Answers in AppDelegate.o "_OBJC_CLASS_$_Crashlytics", referenced from: type metadata accessor for __ObjC.Crashlytics in AppDelegate.o "_OBJC_CLASS_$_Fabric", referenced from: type metadata accessor for __ObjC.Fabric in AppDelegate.o ld: symbol(s) not found for architecture x86_64 clang: error: linker command failed with exit code 1 (use -v to see invocation)
ld:警告:自动链接提供了“~/GameFolder/Pods/Fabric/tvOS/Fabric.framework/Fabric”,~/GameFolder/Pods/Fabric/tvOS/Fabric.framework/Fabric 中的框架链接器选项不是动态库未定义体系结构 x86_64 的符号:“_OBJC_CLASS_$_Answers”,引用自:GameScene.o 中的 __ObjC.Answers 类型元数据访问器,AppDelegate.o 中的 __ObjC.Answers 类型元数据访问器“_OBJC_CLASS_$_Crashlytics”,引用自:__ObjC 元数据访问AppDelegate.o“_OBJC_CLASS_$_Fabric”中的.Crashlytics,引用自:AppDelegate.o ld中__ObjC.Fabric的类型元数据访问器:找不到架构x86_64 clang的符号:错误:链接器命令失败,退出代码为1(使用-v 查看调用)
Reason
原因
- My target was overriding the
OTHER_LDFLAGS
.
- 我的目标是覆盖
OTHER_LDFLAGS
.
Solution
解决方案
- Changed the
OTHER_LDFLAGS
to just inherit the Linker Flags. Basically, changed it to$(inherited)
- 将 更改
OTHER_LDFLAGS
为仅继承链接器标志。基本上,将其更改为$(inherited)
回答by Zaid Pathan
I followed all steps provided by @i'L'i but I was not able to find Crashlytics.framework
and Fabric.framework
file in build phases.
我遵循了@i'L'i 提供的所有步骤,但无法在构建阶段找到Crashlytics.framework
并Fabric.framework
归档。
So this helped me.
所以这对我有帮助。
Step 1:Follow all the steps given Here.
Step 2:Now when you are unable to find Crashlytics.framework
and Fabric.framework
files in Link Binary With Libraries
by clicking +
do following.
第2步:现在,当您无法找到Crashlytics.framework
并Fabric.framework
在文件中Link Binary With Libraries
通过点击+
做以下。
2.1:Click on +
button in Link Binary With Libraries
.
2.2:Click on Add Other...
button.
2.3:Now chose Crashlytic.framework
and Fabric.framework
from Pod
folder - if using cocoapods, else choose both file from where you have downloaded it.
2.1:点击 中的+
按钮Link Binary With Libraries
。
2.2:点击Add Other...
按钮。
2.3:现在选择Crashlytic.framework
和Fabric.framework
来自Pod
文件夹 - 如果使用 cocoapods,否则从下载文件的位置选择这两个文件。
Step 3:Build Succeeded, Enjoy. :)
第 3 步:构建成功,享受。:)
回答by iagomr
For future reference, this can also happen if you link your test files to your app target.
为了将来参考,如果您将测试文件链接到应用程序目标,也会发生这种情况。
For example: https://github.com/realm/realm-cocoa/issues/1661
回答by KPM
Conversely to what I'L'I and user3517250 mention, the problem might also be that you have #import
statements that shouldn't be there.
与 I'L'I 和 user3517250 提到的相反,问题也可能是您有#import
不应该存在的语句。
Xcode does infer the frameworks to link against from the #import
statements. If you import a framework that you don't link against, then you get this warning.
Xcode 确实从#import
语句中推断出要链接的框架。如果您导入未链接的框架,则会收到此警告。
回答by user3517250
I had the same problem. Maybe I messed up the initial fabric install but once I added Fabric.framework to the list of frameworks (should be in the root folder of your app by default) everything worked.
我有同样的问题。也许我搞砸了最初的结构安装,但是一旦我将 Fabric.framework 添加到框架列表中(默认情况下应该在应用程序的根文件夹中),一切正常。