使用 swift 安装 pod 时出错 运行
Error running pod install with swift
我遵循了 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 时,出现以下错误:
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.
已更新:
下面是我的控制台日志:
$ 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.
添加“use_frameworks!”添加到您的 Podfile 因为:
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.
将 "use_frameworks!" 添加到您的 Podfile:
请参阅下面的示例 Podfile
target 'MySample' do
pod 'AFNetworking', '~> 2.5'
pod 'Net', '~> 0.2' #This is a sample in Swift
use_frameworks! # <--Use this line
end
Podfile 中写的是取消注释 use_frameworks!你使用的是 Swift 所以你只需要取消注释这一行就可以了
# Uncomment this line to define a global platform for your project
# platform :ios, '8.0'
# Uncomment this line if you're using Swift
use_frameworks!
target 'YourProjectName' do
pod 'SwiftyJSON', '~> 2.1'
pod 'SwiftSpinner', '~> 0.6'
pod 'Alamofire', '~> 1.1'
pod 'SuperRecord', '~> 1.2'
pod 'Toucan'
# all other pods goes here
end
target 'YourProjectName' do
end
target 'YourProjectName' do
end
解决方法很简单。您只需将这些行添加到您的 pod 文件中:
target 'PassDTAFirebase' do
inherit! :complete
# Here your pods
use_frameworks!
end
我的情况是,我曾经通过命令 sudo gem install cocoapods
升级 cocoapods,我的问题得到了解决。我在我的项目中使用了 objective - c 和 swift 库。
我遵循了 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 时,出现以下错误:
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.
已更新:
下面是我的控制台日志:
$ 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.
添加“use_frameworks!”添加到您的 Podfile 因为:
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.
将 "use_frameworks!" 添加到您的 Podfile:
请参阅下面的示例 Podfile
target 'MySample' do
pod 'AFNetworking', '~> 2.5'
pod 'Net', '~> 0.2' #This is a sample in Swift
use_frameworks! # <--Use this line
end
Podfile 中写的是取消注释 use_frameworks!你使用的是 Swift 所以你只需要取消注释这一行就可以了
# Uncomment this line to define a global platform for your project
# platform :ios, '8.0'
# Uncomment this line if you're using Swift
use_frameworks!
target 'YourProjectName' do
pod 'SwiftyJSON', '~> 2.1'
pod 'SwiftSpinner', '~> 0.6'
pod 'Alamofire', '~> 1.1'
pod 'SuperRecord', '~> 1.2'
pod 'Toucan'
# all other pods goes here
end
target 'YourProjectName' do
end
target 'YourProjectName' do
end
解决方法很简单。您只需将这些行添加到您的 pod 文件中:
target 'PassDTAFirebase' do
inherit! :complete
# Here your pods
use_frameworks!
end
我的情况是,我曾经通过命令 sudo gem install cocoapods
升级 cocoapods,我的问题得到了解决。我在我的项目中使用了 objective - c 和 swift 库。