channa ly
channa ly

Reputation: 9937

Error running pod install with swift

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.

Upvotes: 36

Views: 28227

Answers (5)

Yogesh Dalavi
Yogesh Dalavi

Reputation: 73

I my case i used to upgrade cocoapods by command sudo gem install cocoapods and my issue got resolved. I used objective - c as well as swift libraries in my project.

Upvotes: 0

joan checo cigollen
joan checo cigollen

Reputation: 21

the solution is very simple. You only have to add these lines to your pod file:

target 'PassDTAFirebase' do

  inherit! :complete

    # Here your pods

  use_frameworks! 

end

Upvotes: 0

Mina Fawzy
Mina Fawzy

Reputation: 21472

as it written in Podfile it says uncomment use_frameworks! is your are using Swift so all you have to do uncomment this line and all works just fine

# 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

Upvotes: 9

Meet
Meet

Reputation: 4934

Add "use_frameworks!" to your Podfile:

Please see below sample Podfile

target 'MySample' do

  pod 'AFNetworking', '~> 2.5'

  pod 'Net', '~> 0.2' #This is a sample in Swift

  use_frameworks! # <--Use this line
end

Upvotes: 58

gagarwal
gagarwal

Reputation: 4244

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/

Upvotes: 37

Related Questions