I just imported Alamofire into a Swift project (via cocoapods) and my build fails because of Alamofire. XCode says there are 138 errors in Alamofire.
Here is a pick of just one error (given in the Alamofire.swift file).
value of optional type String not unwrapped :
extension NSURL: URLStringConvertible {
public var URLString: String {
return absoluteString // error shows here
}
}
Most errors are "swift compiler errors"
I have tried the following :
closing and reopening XCode
pod remove repo master / pod setup / pod install
rm -rf MyProject.xcworkspace / pod install
but no success so far.
I am running the latest cocoapods pre-release (0.39.0.beta.4) and XCode 6.4
Any suggestions ?
Well, you are using Xcode 6.4, which uses Swift 1.2
Since the master branch of Alamofire now uses Swift 2.0 you'll need to update to Xcode 7
Alternatively you can supply the version '1.3.1' in your podfile, as this was the last version using Swift 1.2.
In Pod file insert Below code....It works for me.
xcode version should be 7.3+
swift should be 2.2 (In preferences-> location-> select command line tool-> xcode 7.3).
source 'https://github.com/CocoaPods/Specs.git'
platform :ios, '9.3'
use_frameworks!
target 'Your Target Name' do
pod 'Alamofire', '~> 3.0'
end
I hope it will work for you.
I was using Swift2.0 but i used Alamofire 1.2.2 which caused compiler problems. After i switched to Alamofire 2.0 in the Pod Files, everything worked fine.
pod 'Alamofire', '~> 2.0'
Related
CocoaPods - 1.1.1
My pod file looks like this:
target 'MyNewProject' do
pod 'XLPagerTabStrip', '~> 5.0'
pod 'AFNetworking', '~> 3.0'
end
use_frameworks!
XLPagerTabStrip library is installed with an old swift version and xcode propose me convert it up to 2.3 or 3.0. This issue is noticed with other swift libraries e.g. Reactive Cocoa
Thank you!
As mintioned in XLPagerTabStrip - Change Log:
6.0.0
Swift 3 support
So updating its pod to the latest version should let it supports Swift 3 by default.
You can add it as pod 'XLPagerTabStrip' without specifying the version number, which causes to get latest version (it's the default behavior if you are not specifying the version number).
Change: pod 'XLPagerTabStrip', '~> 5.0' to pod 'XLPagerTabStrip'
As mentioned, you should get version 6.0.0 (latest version).
Finally, your pod file should look like:
target 'MyNewProject' do
pod 'XLPagerTabStrip'
pod 'AFNetworking', '~> 3.0'
end
use_frameworks!
Recap: After making sure that the latest version of a library has been released to support -for example- Swift 3, install it without specifying the version number; Each time you'll update the podfile, it will automatically install the latest version of the pod.
For more information, you can check Podfile Syntax Reference.
Hope this helped.
Cocoapods is no longer generating all the required headers in Pods/Headers/Private and thus causing hundreds of "missing from working copy" build issues.
The issue started happening when I upgraded from:
Xcode 7
Cocoapods pre-1.0 (not sure which version I had)
OSX El Capitan
platform ios 7.0
to
Xcode 8 Beta 6
Cocoapods 1.0.1
macOS Sierra 10.12 Beta
platform ios 8.0
My "Pods/Target Support Files" folder has 35 pods, but my "Pods/Headers/Private" and "Pods/Headers/Private" have only 4 pods each.
I tried adding "$(inherited)" to my build settings and many other of the suggested fixes on stackoverflow and cocoapods' website with no success.
platform :ios, '8.0'
target 'Meow' do
use_frameworks!
pod "AFNetworking"
pod 'SCLAlertView-Objective-C'
pod "MMMaterialDesignSpinner"
pod "JMImageCache"
pod “AWSCore”
pod “AWSSNS”
pod “AWSMobileAnalytics”
pod ”SSToolkit”, '~> 2.0.0'
pod ”TTTAttributedLabel”
pod ”M13ProgressSuite”
pod ”SSKeychain”
pod 'FBSDKCoreKit'
pod 'FBSDKLoginKit'
pod "Flurry-iOS-SDK"
pod "TPKeyboardAvoiding"
pod "UITextView+Placeholder"
pod "UIReadMoreLabel"
pod "RTLabel"
pod "HexColors"
pod "Branch"
pod 'Google/Analytics'
pod 'Mixpanel'
pod 'Fabric'
pod 'Crashlytics'
target 'MeowTests' do
inherit! :search_paths
end
end
Any help is super appreciated!
Henri
After lots of digging and trial/error I figured it out. The root issue was the upgrade from Cocoapods 0.39 to 1.0+.
You can solve this by following theses steps:
Remove any build settings you're overriding by following this: Cocoapods no longer builds project after update?
Downgrade from v1.0+ to 0.39 following this: How to downgrade or install an older version of Cocoapods
Delete the Pods folder, the Pod lock file
Add this line to the top of your Podfile
source "https://github.com/CocoaPods/Old-Specs"
Run pod install
Run cmd+k in Xcode and compile.
More Resources:
http://blog.cocoapods.org/Sharding/
To me #cybermach answer is partially helpful.
The full answer is:
1- Downgrade the CocoaPods from 1.0 to 0.39 using this link:
Install old cocoapods?
2- Then use this command "pod install" to again add the private headers.
Hello i have a issue trying use alamofire 1.3, i need this because my projects wasn't migrated to swift 2.0, so here is my pod file:
source 'https://github.com/CocoaPods/Specs.git'
platform :ios, '7.0'
use_frameworks!
target 'AppName' do
pod 'Alamofire', '~> 1.3'
end
But always get this error:
Resolving dependencies of Podfile
[!] Unable to satisfy the following requirements:
- Alamofire (~> 1.3) required by Podfile
Any idea?
You cannot use Alamofire with CocoaPods with a deployment target of 7.0. It MUST be 8.0+. The reason for this is that Swift frameworks are not supported on iOS 7.
Today i've started to get 2 errors in CPTAnimationPlotRangePeriod.m:
I have tried to clean the project but it doesn't do anything.
It started when i tried to install this: https://github.com/devxoul/JLToast. I have followed all the instruction:
gem install cocoapods --pre
Add this to my Podfile: pod 'JLToast'
Do pod install
This is how my Podfile looks like:
# Uncomment this line to define a global platform for your project
# platform :ios, '7.0'
target '[Project name]' do
pod 'CorePlot', :git => 'https://github.com/core-plot/core-plot.git', :branch => 'release-2.0'
pod 'JLToast'
end
The new version of Cocoapods enabled a new build option that broke Core Plot builds. It's fixed in the latest code. See issue 138 for details.
Point your pod file at the repository head rather than a release number.
Rather than editing your Podfile, you also have the option of fixing the CorePlot code within your project. The required code changes are here: https://github.com/IngmarStein/core-plot/commit/3413d8b7fa382921a918e7801a22e614a17b8bbf
The first version I released for my framework was 1.0.0.
I just finished version 1.1.0 and wanted to update the the version in cocoa pods.
Steps I did:
Updated podspec file (Changed the version and tag to 1.1.0 and added a framework that I needed).
I first pushed the changes to Github using the Github for Mac app
Ran pod lib lint and passed validation
Entered git add -A && git commit -m "Release 1.1.0" and got a weird (Your branch is ahead of 'origin/master' by 1 commit).
Entered git tag '1.1.0'
Entered git push --tags (and it said everything was good and it showed 1.1.0 passing).
When I search my framework in pod search "name" it still shows 1.0.0 as the version.
Did I miss something or does it take some time to update?
You just follow the below terminal commands.
While your going to update your pods you just focus on the below terminal commands.These commands are more than enough for update your pods. Hope it may help you.
Open the Terminal:
$sudo gem update —system
$sudo gem uninstall cocoapods
$sudo gem install cocoapods
$pod setup
$cd <project path>
$pod init
$ open -a Xcode Podfile
add files(framework name) into to your pod file.
Example:
platform :ios, '7.0'
pod 'FBSDKLoginKit'
pod 'FBSDKCoreKit'
pod 'FBSDKShareKit'
pod 'FBAudienceNetwork'
pod 'FBSDKMessengerShareKit'
Save your pod file. then,
$pod install
$pod update(if you need)
The frameworks will downloading the latest version, if we are not mentioning the version name (Ex:
pod 'AFNetworking', '~> 2.5'
)
platform :ios, '7.0' (The version 7.0 is your Deployment target)
Open your project folder --> Open the project workspace not the Xcode project.
Clean the Project.
Run the Project.
Hope it will useful for you.!
Thanks.
please refer to cocoapods spec Cocoa guid
You can use
pod trunk push NAME.podspec
Your steps 4,5,6 is not necessary.