Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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.
like image 413
channa ly Avatar asked Mar 17 '15 04:03

channa ly


People also ask

What is Podfile lock file?

Podfile. lock is used to make sure that every members of the team has the same versions of pods installed on the project. This file is generated after you run the command: pod install. It gets updated when you run pod install or pod update.

How do you install pods?

To install the pods, do one of the following: Place the caret at the code line where you add the pod, press ⌥ ⏎ , select Install, and press ⏎ . Click Install pods in the top-left corner of the editor window. From the main menu, select Tools | CocoaPods | Install.


3 Answers

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
like image 121
Meet Avatar answered Oct 17 '22 14:10

Meet


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/

like image 37
gagarwal Avatar answered Oct 17 '22 16:10

gagarwal


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
like image 9
Mina Fawzy Avatar answered Oct 17 '22 16:10

Mina Fawzy