iOS 9 和 XCode 7 dylib 问题

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

iOS 9 and XCode 7 dylib problems

iosobjective-ciphonexcodeios9

提问by Can Lelo?lu

I am trying to migrate my project from iOS 8 to iOS 9. Any I am getting some library errors. I am using XCode7-beta6.

我正在尝试将我的项目从 iOS 8 迁移到 iOS 9。我遇到了一些库错误。我正在使用 XCode7-beta6。

Here is how it looks like:

这是它的样子:

error: /Applications/Xcode-beta 2.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/libtool: can't open file: /Applications/Xcode-beta 2.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS9.0.sdk/usr/lib/libz.dylib (No such file or directory)

错误:/Applications/Xcode-beta 2.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/libtool:无法打开文件:/Applications/Xcode-beta 2.app/Contents/Developer/Platforms/ iPhoneOS.platform/Developer/SDKs/iPhoneOS9.0.sdk/usr/lib/libz.dylib(没有那个文件或目录)

libz.dylib is included in "Link binary with libraries".

libz.dylib 包含在“链接二进制与库”中。

Now I know that this dylib is a leftover from past because if I remove it then try to add it again I find tbd files instead of dylib files.

现在我知道这个 dylib 是过去遗留下来的,因为如果我删除它然后尝试再次添加它,我会找到 tbd 文件而不是 dylib 文件。

There is an answer here: https://forums.developer.apple.com/message/8609#8609for working around this issue but I have tried adding libz in other linker flags as -libz and also -l. None of them worked.

这里有一个答案:https: //forums.developer.apple.com/message/8609#8609 可以解决这个问题,但我尝试在其他链接器标志中添加 libz 作为 -libz 和 -l。他们都没有工作。

How can I make the project find the library?

我怎样才能让项目找到图书馆?

Thanks

谢谢

回答by tleyden

This worked for me:

这对我有用:

cd /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS9.2.sdk/usr/lib
sudo cp /usr/lib/libz.dylib .

回答by dgatwood

First, upgrade to GM seed and see if the problem goes away.

首先,升级到转基因种子,看看问题是否消失。

Failing that, you might be able to reopen the project using the previous version of Xcode (where it won't fail to build), then change the library (in the file inspector) from being project-relative or absolute to being SDK-relative.

如果做不到这一点,您可能能够使用以前版本的 Xcode(它不会无法构建)重新打开项目,然后将库(在文件检查器中)从项目相关或绝对更改为 SDK 相关.

Failing that, delete the library and re-add it by clicking the "+" to add frameworks and libraries, then dragging the actual dylib from the SDK root to the resulting open dialog (IIRC). Be sure you hunt down every reference to that library. I recommend using "grep -r" on the contents of the .xcodeproj folder.

如果失败,请删除库并通过单击“+”重新添加它以添加框架和库,然后将实际的 dylib 从 SDK 根目录拖到生成的打开对话框 (IIRC) 中。一定要找到对该库的所有引用。我建议对 .xcodeproj 文件夹的内容使用“grep -r”。

回答by Ishara Meegahawala

Just add libz.tbd, It will solve the problem

添加libz.tbd就可以解决问题