Find out which version to install Cocoapods - ios

How and where can i found out which version of the frameworks is preferred to install via cocoapods for different iOS sdks?[some times it shows error incompatible version used]
For example I want to install Restkit.Which will be the statement i need to add in the pod as version number.How it can be identified?

Just have a look at their pod specification (e.g. pod spec for RestKit 0.20.0pre2). There are a couple of lines stating which platform this is based on
# Platform setup
s.requires_arc = true
s.ios.deployment_target = '5.0'
s.osx.deployment_target = '10.7'
So if you want to use RestKit 0.20.0pre2 in your project, you want to use the same settings as a minimum.

Related

How to solve this pod issue "CocoaPods could not find compatible versions for pod" for iOS project?

I put new pods into project pod file and tried to install. Then I received this error in Terminal.
[!] CocoaPods could not find compatible versions for pod "xxxxxxxxxxxxxxx":
In Podfile:
xxxxxxxxxxxxxxx
Specs satisfying the `xxxxxxxxxxxxxxx` dependency were found, but they required a higher minimum deployment target.
Update the minimum iOS version to what's required by the requested podspecs. Add something like this to the Podfile:
platform :ios, '13.0'

CocoaPods - A custom dynamic framework - cannot get the latest version of frameworks

My project in Xcode consist of static frameworks and one custom dynamic framework. This dynamic framework includes some other static frameworks.
When I try to compile the custom dynamic framework itself, everything is fine. I was able to force to install latest version of frameworks (Alamofire, Realm, etc..) by forcing the pod definition file
platform :ios, '9.0'
But when I compile my project even when I use the above line, I am getting the old frameworks.
When I try to force the pods for a explicit version,
pod 'Alamofire', '~> 4.4.0'
getting the version 3.5.1.
Is there any other explicit setting to force CocoaPods to be more accurate in versions?
Originally the project for the dynamic framework was made for the Swift version 2.3, which is actually requiring the version of Alamofire 3.5.1.
Any help will be appreciated.
Maybe try the following in your podfile:
pod 'Alamofire', :git => 'https://github.com/Alamofire/Alamofire.git', :tag => '4.4.0'
That will bypass your local spec repo and get straight from git.
Which version of CocoaPods you have currently installed on your machine? Which version was used to originally establish Pods in project? I've spotted an issue when I updated CocoaPods, that pod update hasn't been working properly, and removing just Podfile.lock and Pods/ directory wasn't sufficient to make things right.
That said I would do the following:
update CocoaPods to newest version
pod repo update for newest Pod specs
pod deintegrate to completely remove Pods from project
pod install to re-create Pods in the project
The solution is kinda tricky. I haven't realise in the beginning that the pods under a dynamic framework cannot actually be executed directly from top project and there is a configuration JSON file, which actually is managing the pods under the dynamic framework.
So the pod versions were actually hardcoded there.

Swift iOS project won't compile if I add any CocoaPod library

I'm new to iOS and am working on an app in Swift. I'd like to use CocoaPods for dependency management, but I am having issues. I've been able to install CocoaPods on my Mac, run pod init to create my pod file, and run pod install to install dependencies just fine. The .xcworkspace file was installed and I've been using it with my project.
My problem comes where after I add any pods to my pod file and run pod install, then go to build my app, there are errors with the pod files that get installed and the project wont build. I've tried a lot of different pods and all have similar errors. My guess is that the errors are related to the Swift version, but I'm not familiar enough with the tools to know how to adjust it.
The project will build fine if I remove the pods from the podfile and run a pod install again.
The errors are all over the files and are things like:
Expected declaration
Consecutive declarations on a line must be separated by ';'
Expected '{' after operator name in operator declaration
My environment specs
pod --version = 1.1.1
XCode Version = 8.2 beta (although I'm seeing the same issues on 8.1)
My podfile:
# Uncomment the next line to define a global platform for your project
platform :ios, '9.0'
target 'MySampleApp' do
# Comment the next line if you're not using Swift and don't want to use dynamic frameworks
use_frameworks!
# Pods for MySampleApp
pod 'Marshal', '~> 1.0'
pod 'FontAwesomeKit', '~> 2.2'
end
Also, the app I'm using is the starter sample app from AWS Mobile Hub. Everything works fine until I add a pod.
Any help would be much appreciated. I just don't know where to go from here.
I've found my problem. The Marshal library I was trying to use was not Swift 2.3 compatible (it was build for Swift 3). The AWS Mobile Hub sample app was using Swift 2.3, so I couldn't compile the two together. I decided to use a different library to parse JSON (pod 'SwiftyJSON', '2.4.0') and my app is building fine.

How to get latest GoogleMaps SDK using pods

I'm trying out the google places sdk sample. I installed it using
pod try GoogleMaps
I installed GoogleMaps (1.10.5) using cocoapods
source 'https://github.com/CocoaPods/Specs.git'
platform :ios, '8.1'
pod 'GoogleMaps'
checking the GoogleMaps in both steps, the one in the sample (1) contains more headers like GMSAutocompleteTableDataSource.h
Why are they different? The one in the sample seems to be a better version but the one given by pods is not the latest? Its not even in the changelog
Run pod update GoogleMaps. Cocoapods won't update the version of a pod you've already downloaded unless you explicitly run pod update or update the podspec to require a newer version. See https://guides.cocoapods.org/using/pod-install-vs-update.html for more details.
I checked the latest podspec
I just need to set the version to the latest
e.g
pod 'GoogleMaps', '~> 2.5.0'
In my project's podfile, I don't specify the version. The pod line just specifies: pod 'GoogleMaps'
So, if you don't include the version in the podfile, then the following command in a Terminal window will update to the latest version: pod 'GoogleMaps'
Please ensure the you are in the correct folder containing your podfile before entering this command.
It may take a while for Pod to process when you see this message: Updating local specs repositories.
Be patient - it took about 20 minutes.
I just ran into this error, and I updated to latest GoogleMaps per the advice above, but had to delete the app on my device and install fresh for it to resolve the error. Error was still present until I did that.

How to ignore the Base SDK for a single pod

For an iOS project that requires iOS 5.1 I want to include an Pod that requires at least iOS 6.0 (ARChromeActivity). When I'm trying to install this Pod I only get the message:
[!] The platform of the target `Pods` (iOS 5.1) is not compatible with `ARChromeActivity (1.0.0)` which has a minimum requirement of iOS 6.0.
How can I include this Pod in my project anyway and ignore the base SDK for this single Pod?
Disclaimer: The purpose of the podspec's platform attribute is to make sure the library isn't installed with a version of the OS it has not been tested on by its maintainers. That being said, in your Podfile you can simple change the platform requirements to what you want to emulate for example,
platform :ios, '6.0'
Obviously that is for all your pods not just a single one but you can see why that feature doesn't exist. In the newer versions of CocoaPods you actually don't need that line at all and it will detect your target version from your project, obviously since you're trying to use code that's not meant for the version you're using that wouldn't help you but it's typically quite useful.
Edit:
Alternatively you can edit the spec's source directly. In this case open ~/.cocoapods/master/ARChromeActivity/1.0.0/ARChromeActivity.podspec in some editor and change:
s.platform = :ios, '6.0'
to
s.platform = :ios, '5.0'
Then run pod install
The correct thing to do would be not to change s.platform in the Podspec but to fix the s.io.deployment target:
s.ios.deployment_target = '5.0'

Resources