Swift 2/iOS 9 - 找不到 libz.dylib [英] Swift 2 / iOS 9 - libz.dylib not found

查看:31
本文介绍了Swift 2/iOS 9 - 找不到 libz.dylib的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在我的新 Swift 2.0 项目中使用了一些来自 google 的外部代码,这些代码在早期版本中需要libz.dylib".更新到新的 Xcode/新的 SDK 后.

I'm using some external codes from google in my new Swift 2.0 project that required "libz.dylib" in earlier versions. After updating to the new Xcode / the new SDK.

Xcode 现在无法导入 libz.dylib 并引发一些错误

Xcode is now unable to import the libz.dylib and throws some errors

架构 i386 的未定义符号:_deflate",引用自:+[GAICompressionUtil gai_dataByCompressingBytes:length:compressionLevel:mode:] 在 libGoogleAnalyticsServices.a(GAICompressionUtil.o)_deflateEnd",引用自:+[GAICompressionUtil gai_dataByCompressingBytes:length:compressionLevel:mode:] 在 libGoogleAnalyticsServices.a(GAICompressionUtil.o)deflateInit2",引用自:+[GAICompressionUtil gai_dataByCompressingBytes:length:compressionLevel:mode:] 在 libGoogleAnalyticsServices.a(GAICompressionUtil.o)_inflate",引用自:+[GAICompressionUtil gai_dataByInflatingBytes:length:isRawData:] 在 libGoogleAnalyticsServices.a(GAICompressionUtil.o)_inflateEnd",引用自:+[GAICompressionUtil gai_dataByInflatingBytes:length:isRawData:] 在 libGoogleAnalyticsServices.a(GAICompressionUtil.o)inflateInit2",引用自:+[GAICompressionUtil gai_dataByInflatingBytes:length:isRawData:] 在 libGoogleAnalyticsServices.a(GAICompressionUtil.o)ld:找不到架构 i386 的符号clang:错误:链接器命令失败,退出代码为 1(使用 -v 查看调用)

Undefined symbols for architecture i386: "_deflate", referenced from: +[GAICompressionUtil gai_dataByCompressingBytes:length:compressionLevel:mode:] in libGoogleAnalyticsServices.a(GAICompressionUtil.o) "_deflateEnd", referenced from: +[GAICompressionUtil gai_dataByCompressingBytes:length:compressionLevel:mode:] in libGoogleAnalyticsServices.a(GAICompressionUtil.o) "deflateInit2", referenced from: +[GAICompressionUtil gai_dataByCompressingBytes:length:compressionLevel:mode:] in libGoogleAnalyticsServices.a(GAICompressionUtil.o) "_inflate", referenced from: +[GAICompressionUtil gai_dataByInflatingBytes:length:isRawData:] in libGoogleAnalyticsServices.a(GAICompressionUtil.o) "_inflateEnd", referenced from: +[GAICompressionUtil gai_dataByInflatingBytes:length:isRawData:] in libGoogleAnalyticsServices.a(GAICompressionUtil.o) "inflateInit2", referenced from: +[GAICompressionUtil gai_dataByInflatingBytes:length:isRawData:] in libGoogleAnalyticsServices.a(GAICompressionUtil.o) ld: symbol(s) not found for architecture i386 clang: error: linker command failed with exit code 1 (use -v to see invocation)

在构建阶段"设置中查看可用包时,我可以找到libz.tbd",它似乎是 libz.dylib 的替代品.导入此库时,链接器错误保持不变,但我收到此附加警告:

When looking through the available packages in the "build phase" settings I can find "libz.tbd" which seems to be the replacement for the libz.dylib. When importing this lib the linker error stays the same but I get this additional warning:

警告:跳过文件'/Applications/Xcode-beta.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator9.0.sdk/usr/lib/libz.tbd'(意外的文件类型'文本"在框架和库构建阶段)

warning: skipping file '/Applications/Xcode-beta.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator9.0.sdk/usr/lib/libz.tbd' (unexpected file type 'text' in Frameworks & Libraries build phase)

怎么办?

推荐答案

我遇到了同样的问题.我找到了某种方法.

I had the same problem. I found some kind of way around.

  1. 转到构建阶段>将二进制文件与库链接> + > 添加其他
  2. 在文件选择窗口中执行CMD"+Shift+G(转到文件夹)并输入/usr/lib/
  3. 从/usr/lib 你可以添加:libz.dylib 等等...
  4. 编译并玩得开心

这篇关于Swift 2/iOS 9 - 找不到 libz.dylib的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆