使用swift运行pod安装时出错 [英] Error running pod install with swift

查看:491
本文介绍了使用swift运行pod安装时出错的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我按照Cocoapods的指示。



以下是我的Podfile:

  platform:ios,'8.2'

pod'SwiftyJSON','〜> 2.1'
pod'SwiftSpinner','〜> 0.6'
pod'Alamofire','〜> 1.1'
pod'SuperRecord','〜> 1.2'
pod'Toucan

当我做 pod install 时我收到以下错误:


用Swift编写的Pod只能作为框架集成;此功能仍处于测试阶段。将 use_frameworks!添加到您的Podfile或目标以选择使用它。


更新:



以下是我的控制台日志:

  $ pod install 
分析依赖项
下载依赖项
安装Alamofire(1.1.4)
安装SuperRecord(1.2)
安装SwiftSpinner(0.6.0)
安装SwiftyJSON( 2.1.3)
安装Toucan(0.2.0)
[!]用Swift编写的Pod只能作为框架集成;此功能仍处于测试阶段。将use_frameworks!添加到您的Podfile或目标以选择使用它。


解决方案

添加use_frameworks!到你的Podfile因为:


因为Apple不允许你构建包含
Swift的静态库。与Objective-C不同,Apple不提供带有iOS的Swift标准
运行时库。这将语言版本与平台版本的
分离。当您使用Swift构建应用程序时,您需要自己负担b $ b b。默认情况下,Xcode使用
swift-stdlib-tool来处理复制Swift运行时dylibs,但是当尝试使用Swift
的框架运送带有Objective-的应用程序时,
工具不足。仅限C。您的应用程序可执行文件和您发布的
框架都将使用相同的dylib集合,这些dylib是嵌入到应用程序包的Frameworks子目录中的



<首先,那是因为你无法链接到
标准库的不同版本。此外,由于存储器大小的限制和
网络速度的限制,因此需要将它们仅嵌入
一次而不是多次,这与分发相关。
您可以通过指定use_frameworks来使CocoaPods通过框架
而不是静态库集成到您的项目中。如果
不存在,那么如果
依赖于包含Swift源代码的pod,则无法集成依赖项。


参考: http://blog.cocoapods.org/CocoaPods-0.36/


I followed the instruction from Cocoapods.

Below is my Podfile:

platform :ios, '8.2'

pod 'SwiftyJSON', '~> 2.1'
pod 'SwiftSpinner', '~> 0.6'
pod 'Alamofire', '~> 1.1'
pod 'SuperRecord', '~> 1.2'
pod 'Toucan

When I did pod install I got the following error:

Pods written in Swift can only be integrated as frameworks; this feature is still in beta. Add use_frameworks! to your Podfile or target to opt into using it.

Updated:

Below is my console log:

$ pod install
Analyzing dependencies
Downloading dependencies
Installing Alamofire (1.1.4)
Installing SuperRecord (1.2)
Installing SwiftSpinner (0.6.0)
Installing SwiftyJSON (2.1.3)
Installing Toucan (0.2.0)
[!] Pods written in Swift can only be integrated as frameworks; this feature is still in beta. Add `use_frameworks!` to your Podfile or target to opt into using it.

解决方案

Add "use_frameworks!" to your Podfile because:

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.

Reference: http://blog.cocoapods.org/CocoaPods-0.36/

这篇关于使用swift运行pod安装时出错的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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