Alamofire with Swift 3.0 & Deployment Target 8.0 - ios

What is the way to integrate Alamofire with Swift 3.0 and also have to provide support for iOS 8 ? Is there any other option then Alamofire ?

Upgrading to the latest Cocoapods do like this
gem install cocoapods --pre
seems to solve the issue for my circumstance.

source 'https://github.com/CocoaPods/Specs.git'
platform :ios, '10.0'
above this line only specification use this alamofire platform if u want all platform then remove this platform line and second thing is deployment target select 8.0 so all platform in use alamofire.
use_frameworks!
target '<Your Target Name>' do
pod 'Alamofire', '~> 4.4'
end

Related

CocoaPods could not find compatible versions for pod "Alamofire 5.0.0-rc.2 "

I'm using ‘Alamofire’, ‘~> 5.0.0-beta.5’ via CocoaPods in my swift project . Now I'm trying to use Alamofire (~> 5.0.0-rc.2).
Unfortunately I got the following error after applied "pod install" command line:
CocoaPods could not find compatible versions for pod "Alamofire": In
Podfile:
Alamofire (~> 5.0.0-rc.2)
Any help?
As the release is new (only 2 days ago), you first need to update your local specs repositories.
In your Podspec file, put this:
pod 'Alamofire', '~> 5.0.0-rc.2'
On the terminal, run:
pod update
Then:
pod install
Output:
Analyzing dependencies
Downloading dependencies
Using Alamofire (5.0.0-rc.2)
Generating Pods project
Integrating client project
Sending stats
Pod installation complete! There is 1 dependency from the Podfile and 1 total pod installed.
Maybe in some situations when other points so not work. Check this issue:
platform :ios, '9.0' // check platform :ios version
target "app_name" do
pod 'Alamofire', '~> 5.0.0-rc.3'
end
In my situation deployment target was set to 9.0 but Alamofire 5+ is on the 10.0 version.
/** Alamofire.podspec **/
...
s.ios.deployment_target = '10.0'
s.osx.deployment_target = '10.12'
s.tvos.deployment_target = '10.0'
s.watchos.deployment_target = '3.0'
s.swift_versions = ['5.0', '5.1']
...
Just replace platform :ios, '9.0' to platform :ios, '10.0' and the problem will be solved. Source: Alamofire.podspec
I think you can use pod search Alamofire first and then use the version which is on the list. And if the version is not neccessary, you can just use pod 'Alamofire'.

Getting errors in podfile

I install SCLAlertView by using podfile.
I'm getting 300 errors on SCLAlertView.swift file.
I'm using Xcode 7.
How to resolve the problem.
Here is my podfile
platform :ios, '8.0'
target `SCLAlertView2` do
pod `SCLAlertView`
end
target `IceCreamShopTests` do
end
it generate podfile of SCLAlertView.swift but getting 300 error.
Xcode be it is latest version not work on xcode 7)
First
If you check in Branch you can find the swift 2.3 supported version of SCLAlertView
https://github.com/vikmeup/SCLAlertView-Swift/tree/swift-2.3
You can directly use instead of installing cocoapods.
Second
If you check SCLAlertView.podspec you can find the version of cocoapods then you can install that via pods by
pod 'SCLAlertView', '~> 0.6'
If you want to support xcode 7.3 and swift 2.3 other wise if you use swift 3+ then use
pod 'SCLAlertView', '~> 0.7'
Hope that information get your issue fixed.

Why is there an error in swift grammar

The tool involved is Xcode7.2, which is installed using CocoaPod
source 'https://github.com/CocoaPods/Specs.git'
platform :ios, '8.0'
use_frameworks!
pod 'Alamofire', '~> 3.0'
However, there is a large number of compilation errors as shown in the picture. Can I ask why are these errors?
The #selector special form was added in Swift 2.2, which is shipped with Xcode 7.3. You're using Xcode 7.2. You need to either upgrade Xcode, or use a slightly older version of AlamoFire.

Xcode 6.4: External libraries not getting imported properly

I posted a similar question yesterday but please bear with me. I am trying to install libraries such as ObjectMapper, Alamofire, etc. using Cocoapods (updated to latest version). I can successfully install the pods but as soon as I open <>.xcworkspace, I get build errors in the library files. I had installed SwiftyJSON a month ago using CocoaPods and it didn't give me a problem at the time. I tried installing SwiftJSON in an entirely new project using CocoaPods and it is giving me the build issues now. Please help! There are no references for this!
My current Cocoapods version is 0.38.2. My project's deployment target is 8.4.
This is my Podfile
# Uncomment this line to define a global platform for your project
# platform :ios, '6.0'
target 'retailcatalogue' do
source 'https://github.com/CocoaPods/Specs.git'
platform :ios, '8.0'
use_frameworks!
pod 'SwiftyJSON'
end
target 'retailcatalogueTests' do
source 'https://github.com/CocoaPods/Specs.git'
platform :ios, '8.0'
use_frameworks!
pod 'SwiftyJSON'
end
My current version of Xcode is Version 6.4 (6E35b). Could that be a factor?
I just updated my Xcode to 7.0.1 and everything's working great! Thank you everyone!
Try using this:
use_frameworks!
target 'retailcatalogue' do
pod 'SwiftyJSON', :git => 'https://github.com/SwiftyJSON/SwiftyJSON.git'
end

watchOS 2 working with CocoaPods

Has anyone gotten CocoaPods working with watchOS 2? I tried using ‘use_framework!’ with ‘platform :watchos, ‘2.0’ but it says "[!] Invalid Podfile file: Unsupported platform watchos2. Platform must be :ios or :osx.. Updating CocoaPods might fix the issue.”
I am on the latest version of CocoaPods.
CocoaPods released new version which is 0.38.0 and now supports watchOS 2.
http://blog.cocoapods.org/CocoaPods-0.38/
According to the blog above, deployment target can be set to watchOS 2 in Podspec.
Pod::Spec.new do |s|
# …
s.watchos.deployment_target = '2.0'
end
You can set target for watchOS 2 in Podfile with the version.
However, library has to set the deployment target explicitly, so you need to check whether it's supported for each library in Podspec.
The latest version of CocoaPods supports this.
If you just need to get a pod working on watchOS 2 (e.g. Parse), the you can simply use a Podfile such as this:
# 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 'MyApp' do
end
target 'MyApp WatchKit App' do
end
target 'MyApp WatchKit Extension' do
platform :watchos, '2.0'
pod 'Parse', '~> 1.11'
end
If however, you need to use the pod in multiple targets of different platforms (e.g. iOS and watchOS 2), things are slightly tricker. See this answer for more information.
CocoaPods currently doesn't support watchos. There is a work in progress issue here for adding support for it.

Resources