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

2016-12-30日 更新

pod更新后之前Podfile写法可能会不能正常使用,可以尝试新的写法,指定工程:

platform :ios, '8.0'
use_frameworks!
target “工程名” do
pod 'Charts', '~> 2.1.6'
end

在使用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, '8.0'
pod 'Charts', '~> 2.1.6'
use_frameworks!

这样就可以了。

评论 3
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值