Pods written in Swift can only be integrated as frameworks; add `use_frameworks!` to your Podfile or

在使用cocoapod导入swift第三方时出现这样的问题:
Pods written in Swift can only be integrated as frameworks; add use_frameworks! to your Podfile or target to opt into using it. The Swift Pod being used is: Charts
一开始我安装oc的配置方法

platform :ios,'8.0'
pod 'Charts','~> 2.1.6'

结果报错了。

链接大神文章链接

Because Apple doesn't let you build static libraries that contain Swift. Unlike Objective-C,Apple doesn't ship the Swift standard runtime libraries with iOS. This decouples the language version from the platform version. When you build an app with Swift,you're responsible yourself to ship them. By default,Xcode uses swift-stdlib-tool to handle copying the Swift runtime dylibs,but the tooling falls short when attempting to ship frameworks that use Swift with an app that is Objective-C only. Your app executable and the frameworks you ship will all use the same set of dylibs,which are embedded into the Frameworks subdirectory of the application bundle.

First,that's because you can't link against different versions of the standard libraries. Furthermore it is desirable to embed them only once and not multiple times,because of constraints to memory size and network speed,which are relevant for distribution. You can make CocoaPods integrate to your project via frameworks instead of static libraries by specifying use_frameworks!. If that's not present,you won't be able to integrate dependencies,if you depend on a pod which includes Swift source code.

英文不好是硬伤啊,大概意思是:苹果不允许建包含swift的静态库,不同于OC可以使用平台版本的语言版本。
针对这种问题,可以做这样的处理:

platform :ios,'~> 2.1.6'
use_frameworks!

这样就可以了。

相关文章

软件简介:蓝湖辅助工具,减少移动端开发中控件属性的复制和粘...
现实生活中,我们听到的声音都是时间连续的,我们称为这种信...
前言最近在B站上看到一个漂亮的仙女姐姐跳舞视频,循环看了亿...
【Android App】实战项目之仿抖音的短视频分享App(附源码和...
前言这一篇博客应该是我花时间最多的一次了,从2022年1月底至...
因为我既对接过session、cookie,也对接过JWT,今年因为工作...