Xcode10再坑之framework not found CoreServices for architecture armv7

栏目: 编程工具 · IOS · 发布时间: 7年前

内容简介:之前升级 Xcode10 后,给别人的SDK会报错:为什么 iOS SDK 拖入项目中就报错”ld: framework not found IOSurface for architecture arm64”?其实,之前的文章已经说过解决方案:

1、前言

之前升级 Xcode10 后,给别人的SDK会报错:

ld: framework not found CoreServices for architecture armv7

为什么 iOS SDK 拖入项目中就报错”ld: framework not found IOSurface for architecture arm64”?

其实,之前的文章已经说过解决方案: Xcode8报错:”Framework not found IOSurface for architecture arm64”或者 “Framework not found FileProvider for architecture x86_64/arm64”. | iHTCboy’s blog

当时,反复确认后,网上有些第三方的SDK提供商说升级Xcode10吧!!!慌张~ 你们就只能让别人升级啦!解决不了,重启,升级!但,NO,最后发现是新项目是使用 CocoaPods 导致的坑,一个地方进2次,还真不简单!

2、问题原因

因为我们新的项目使用 CocoaPods 组件化,所以最后打SDK的项目是CocoaPods集成的,问题就出在这里!上一个文章说到解决方法很简单:( Xcode8报错:”Framework not found IOSurface for architecture arm64”或者 “Framework not found FileProvider for architecture x86_64/arm64”. | iHTCboy’s blog

Build Settings 中 Link Frameworks Automatically 把默认Yes 改成 No

但是,如果用 CocoaPods 集成,默认是 Yes !!! 尼玛!!!

知道原因,解决就好办啦!但是,突然想到,以后 pod installpod update 时,难道要人工的设置一次??? 不可能!不可能!不可能!

最后,还是在 CocoaPods 官方文档找到答案 CocoaPods Guides - post_install

Podfile 文件最后,添加下面代码:

post_install do |installer|
    installer.pods_project.targets.each do |target|
        target.build_configurations.each do |config|
            config.build_settings['CLANG_MODULES_AUTOLINK'] = 'NO'
        end
    end
end

这个是一个勾子 hook ,在pod安装完成前,允许更改配置或做些别的事件!

3、总结

这个问题,2次进坑,解决的问题本质是一个,只是自己开始不相信!所以,遇到问题,还是要学会找到原因,不要放弃,不然,只能让别人升级环境来适配你,这可不好哦!

参考

  • 如有疑问,欢迎在评论区一起讨论!
  • 如有不正确的地方,欢迎指导!

注:本文首发于iHTCboy’s blog,如若转载,请注来源


以上就是本文的全部内容,希望对大家的学习有所帮助,也希望大家多多支持 码农网

查看所有标签

猜你喜欢:

本站部分资源来源于网络,本站转载出于传递更多信息之目的,版权归原作者或者来源机构所有,如转载稿涉及版权问题,请联系我们

Python Algorithms

Python Algorithms

Magnus Lie Hetland / Apress / 2010-11-24 / USD 49.99

Python Algorithms explains the Python approach to algorithm analysis and design. Written by Magnus Lie Hetland, author of Beginning Python, this book is sharply focused on classical algorithms, but it......一起来看看 《Python Algorithms》 这本书的介绍吧!

HTML 编码/解码
HTML 编码/解码

HTML 编码/解码

Markdown 在线编辑器
Markdown 在线编辑器

Markdown 在线编辑器

html转js在线工具
html转js在线工具

html转js在线工具