Search code examples
iosswiftcocoapodsswift4ios-charts

CocoaPods issues while adding a new pod


My CocoaPods works fine until I try to install a new one.
If I try to install a new pod, then there are several issues in charts pod, else it works fine.
How do I fix it?

The errors show up as below:

Issues in charts

My podfile is as below:

# Uncomment the next line to define a global platform for your project
platform :ios, '9.0'
use_frameworks!

target 'Tranquil' do
# Comment the next line if you're not using Swift and don't want to use dynamic frameworks

# Pods for TranquillocationText
pod 'GooglePlaces'
pod 'UICircularProgressRing'
pod 'Alamofire', '~> 4.0' . //if i try to add this pod then error occurs
pod 'Charts'
end

Solution

  • Note: Ensure swift language version of your project. Here is how you can see/check your swift language version.

    enter image description here


    You have two options as solution to your query:

    1. If your project has Swift versio 4.0
      - You should choose/download POD compatible to your project's swift language (Share me POD info and swift version, so I can provide you exact pod version version for your pod library suitable for project).

    2. If your project has swift version below 4.0
      - You need to migrate your project into Swift 4.0 (if you've not migrated it). Here is ref question and answer, how to migrate from swift (below) <4.0 to 4.0.


    According to snapshot added by you in your question - Swift 3.x is your current project language version and pod 'Charts' is supporting swift 4.

    pod 'Charts'
    

    Here is list of previous release supporting Swift version below 4.0.

    https://github.com/danielgindi/Charts/releases

    Try previous release of cosmos like:

    pod 'Charts', '~> 3.0.3'
    // or
    pod 'Charts', '~> 3.0.2'
    // or
    pod 'Charts', '~> 3.0.1'
    

    '

    Similar way you can find previous release of Alamofire (supporting Swift below 4.0) from here - Alamofire - Releases

    Try this with Swift 3.2 and see:

    platform :ios, '9.0'
    use_frameworks!
    
    target 'Tranquil' do
    # Comment the next line if you're not using Swift and don't want to use dynamic frameworks
    
    # Pods for TranquillocationText
    pod 'GooglePlaces'
    pod 'UICircularProgressRing', '~> 1.7'
    pod 'Alamofire', '~> 4.0'
    pod 'Charts', '3.0.3'
    pod 'SwiftyJSON', '3.0.0'
    
    end