I am trying to use latest beta tag of MagicalRecord located here:
https://github.com/magicalpanda/MagicalRecord/releases/tag/v2.3.0-beta.5
I am using it in a sdk project that I use in another project. My sdk project will never be a true cocoapod in the repo, but I wrote a podspec to define the transitive deps.
However I am not sure how to list the beta dep of magical record. If I was pointing to the 2.2. version which is published:
s.dependency 'MagicalRecord', '~> 2.2'
But I really want something like this:
s.dependency 'MagicalRecord', '~> https://github.com/magicalpanda/MagicalRecord/releases/tag/v2.3.0-beta.5'
I don't want to have to declare MagicalRecord as a dep in both my sdk project and my main project. I would like the main project to list the local sdk as a dep, and have the sdk deps pulled as well. Works great if everything you use is published. What about things that are not published?
Cocoapoads support using git endpoints. Per the documentation (http://guides.cocoapods.org/using/the-podfile.html):
To use the master branch of the repo:
pod 'AFNetworking', :git => 'https://github.com/gowalla/AFNetworking.git'
To use a different branch of the repo:
pod 'AFNetworking', :git => 'https://github.com/gowalla/AFNetworking.git', :branch => 'dev'
To use a tag of the repo:
pod 'AFNetworking', :git => 'https://github.com/gowalla/AFNetworking.git', :tag => '0.7.0'
Or specify a commit:
pod 'AFNetworking', :git => 'https://github.com/gowalla/AFNetworking.git', :commit => '082f8319af'
I'd recommend using the commit number, as it will provide you with a versioning mechanism.
Related
I'm trying to build application from xcode.
I cloned the project from git repo.
I opened .xcodeproj file and from Product > Build I tried to build but build is failed.
From terminal I executed below commands and receiving compatible version error
I searched for solution and tried few ways like:
sudo gem intall cocoapods
sudo gem intall cocoapods --pre
pod setup
pod deintegrate
pod install
pod update
pod install --repo-update
Below is terminal output:
Analyzing dependencies
Pre-downloading: `BarcodeScanner` from `https://github.com/htothee/BarcodeScanner.git`
Pre-downloading: `MatrixKit` from `https://github.com/N-Pex/matrix-ios-kit.git`, branch `fix_apns_push`
Pre-downloading: `MatrixSDK` from `https://github.com/matrix-org/matrix-ios-sdk.git`, branch `develop`
Pre-downloading: `QRCode` from `https://github.com/brackendev/QRCode.git`
[!] CocoaPods could not find compatible versions for pod "MatrixSDK":
In Podfile:
MatrixKit (from `https://github.com/N-Pex/matrix-ios-kit.git`, branch `fix_apns_push`) was resolved to 0.10.1, which depends on
MatrixSDK (= 0.13.0)
MatrixSDK (from `https://github.com/matrix-org/matrix-ios-sdk.git`, branch `develop`)
Below is Podfile
platform :ios, '9.3'
use_frameworks!
def shared_pods
pod 'ProjectCore', :path => '../'
pod 'MatrixKit', :git => 'https://github.com/N-Pex/matrix-ios-kit.git', :branch => 'fix_apns_push'
pod 'MatrixSDK', :git => 'https://github.com/matrix-org/matrix-ios-sdk.git', :branch => 'develop'
end
target 'Project_Example' do
shared_pods
pod 'BarcodeScanner', :git => 'https://github.com/htothee/BarcodeScanner.git'
pod 'QRCode', :git => 'https://github.com/brackendev/QRCode.git'
pod 'Project', :path => '../'
target 'Project_Tests' do
inherit! :search_paths
end
end
target 'ShareExtension' do
shared_pods
pod 'ProjectExtension', :path => '../'
end
Expected:
.ipa file need to be created
Please let me know how can I solve it.
same problem for me
CocoaPods could not find compatible versions for pod "Branch"
remove Podfile.lock and Pods then do pod install
rm -rf ./Pods Podfile.lock
pod install --repo-update
try this, this worked for me. Thanks.
Your problem is explained in the error:
[!] CocoaPods could not find compatible versions for pod "MatrixSDK":
In Podfile:
MatrixKit (from https://github.com/N-Pex/matrix-ios-kit.git, branch fix_apns_push) was resolved to 0.10.1, which depends on
MatrixSDK (= 0.13.0)
The branch fix_apns_push of MatrixKit needs a fixed version of MatrixSDK, as you can see in its Podspec file
pod 'MatrixSDK', '0.13.0'
So, In order for your project to work, you need this version.
Try this:
def shared_pods
pod 'ProjectCore', :path => '../'
pod 'MatrixKit', :git => 'https://github.com/N-Pex/matrix-ios-kit.git', :branch => 'fix_apns_push'
pod 'MatrixSDK', '0.13.0'
end
insted of projectname.xcodeproj, please try to open projectname.xcworkspace.
I'm trying add add a pod by cocoapods, and I am using swift 3, while the pod(SQlite.swift).
I am trying to use doesn't have a master of the latest swift version, however there is a branch for swift 3.
So how should I set my podfile to download the specific branch? Is it possible?
Here is my podfile:
platform :ios, '10.0'
target 'RedShirt' do
use_frameworks!
# Pods for RedShirt
pod 'SQLite.swift', :git => 'https://github.com/stephencelis/SQLite.swift.git'
end
post_install do |installer|
installer.pods_project.targets.each do |target|
target.build_configurations.each do |config|
config.build_settings['SWIFT_VERSION'] = '3.0'
end
end
end
The podfile guide mentions the following syntax:
To use a different branch of the repo:
pod 'Alamofire', :git => 'https://github.com/Alamofire/Alamofire.git', :branch => 'dev'
^^^
(the space is important)
So in your case, that would be:
pod 'SQLite.swift', :git => 'https://github.com/stephencelis/SQLite.swift.git', :branch => 'swift3-mariotaku'
If you just want to use the main branch (master), write the following command:
pod "SAConfettiView", :git => 'https://github.com/oskarko/SAConfettiView.git'
But if you want to use an alternative/different branch, this one is for you:
pod "SAConfettiView", :git => 'https://github.com/oskarko/SAConfettiView.git', :branch => 'develop'
Easy peasy! 😊
Cocoapods with specific branch
[Cocoapods]
Use :branch in Podfile
pod "SQLite.swift", :git => 'https://github.com/stephencelis/SQLite.swift.git', :branch => 'dev'
//additionally you can use :tag, :commit
Please note, that branch must contain .podspec in root directory
When you specify :branch, Cocoapods will try to find .podspec directly there instead of searching in centralized repository
[Local CocoaPods]
I've been using SwiftyJSON and Alamofire in a project. Recently I downloaded XCode 7 beta. Both SwiftyJSON and Alamofire have separate, non-master branches for Swift 2. Is there a way to get these via CocoaPods, or do I need to install them in the traditional way?
I tried searching on the CocoaPods website to see if these branches had been submitted as separate Pods, but nothing came up. I'm wondering if there is a Podfile syntax that allows you to get a non-master branch.
You can specify any branch from the repository in your Podfile.
Example I'm using for Alamofire:
pod 'Alamofire', :git => 'https://github.com/Alamofire/Alamofire.git', :branch => 'swift-2.0'
Change the line(s) in your Podfile then run pod install again.
There's also this alternative syntax:
pod 'Alamofire', git: 'https://github.com/Alamofire/Alamofire.git', branch: 'swift-2.0'
Update to the current answer. The line above now returns git errors complaining that the 'swift-2.0' branch is not found.
Use this form instead:
pod 'Alamofire', '~> 2.0'
I'm trying to wrap my head around this complex setting:
I have two projects and a shared library. The shared library is a cocoapod.
I would like to be able to use a single workspace to develop in. There are some duplicated pod definitions, but I have this working in a single Podfile.
Here's where it gets complicated:
I want each project/library in its own git repo. Each repo must be able to live on its own; have its own Podfile, be tested/deployed via CI, etc.
Another wrench: we are the git-flow branching strategy... The master branch of project A/B must pull the master branch of the library. The develop branch of project A/B must pull the develop branch of the library.
Has anyone figured this out? Am I going about this in an ass-backwards way?
Here is a working root workspace Podfile:
platform :ios, "7.0"
inhibit_all_warnings!
workspace 'Root.xcworkspace'
xcodeproj 'SharedLibrary/SharedLibrary.xcodeproj'
xcodeproj 'ProjectA/ProjectA.xcodeproj'
xcodeproj 'ProjectB/ProjectB.xcodeproj'
target 'SharedLibrary' do
xcodeproj 'SharedLibrary/SharedLibrary.xcodeproj'
pod 'AFNetworking', '~> 2.0'
pod 'CocoaLumberjack'
end
target 'ProjectA' do
xcodeproj 'ProjectA/ProjectA.xcodeproj'
pod 'AFNetworking', '~> 2.0'
pod 'CocoaLumberjack'
pod 'MagicalRecord', '~> 2.2'
pod 'SharedLibrary', :path => './SharedLibrary/'
end
target 'ProjectB' do
xcodeproj 'ProjectB/ProjectB.xcodeproj'
pod 'AFNetworking', '~> 2.0'
pod 'CocoaLumberjack'
pod 'MagicalRecord', '~> 2.2'
pod 'SharedLibrary', :path => './SharedLibrary/'
end
Here is the shared library's podspec:
Pod::Spec.new do |s|
s.name = "SharedLibrary"
s.version = "0.0.1"
s.platform = :ios, "7.0"
s.source = { :git => "http://not.really.uploaded.anywhere.yet/SharedLibrary.git", :tag => "0.0.1" }
s.source_files = "SharedLibrary", "SharedLibrary/**/*.{h,m}"
s.public_header_files = "SharedLibrary/**/*.h"
s.dependency 'AFNetworking', '~> 2.0'
s.dependency 'CocoaLumberjack'
end
What I did was to define an "exclusive" target for the CocoaPod library. An exclusive target will not link with the rest of the Podfile pods. Basically what you're going to have to do is define your target that points to the Xcode project. Then you need to add the CocoaPod as a dependency using the podspec. Because it's an exclusive target, it won't link with itself. For example,
source 'https://github.com/CocoaPods/Specs.git'
target 'SharedLibrary', :exclusive => true do
xcodeproj 'SharedLibrary/SharedLibrary.xcodeproj'
end
pod 'SharedLibrary', :path => 'SharedLibrary/'
does what you would need it to. The only caveat is that every time you add a public header to the library, you need to run pod update to use it in your project.
Podfile Syntax on Targets
I am using CocoaPods for a macOS app. I have compilation errors with AFNetworking (current version, 1.2.1) and saw that these didn't exist in the previous version (1.2.0).
I did some research but did not find a possibility to define the version of a pod (for example, version 1.2.0 instead of 1.2.1).
Is this possible or do I have to wait until there is a new version of that library?
In your Podfile:
pod 'AFNetworking', '1.2.0'
Check 'Get started' at http://cocoapods.org
Once this is done, you can then issue a pod update in the terminal for the change to take place. Of course, this needs to be done from your project's top level folder. If the update does not occur, edit your Podfile.lock file and change the AFNetworking version # to something less than what it is and issue a pod update in the terminal again. This tells CocoaPods that you have a different version installed and that it must update.
Here, below mentions all possible ways to install pod with use cases.
To install the latest pod version, omit the version number after pod name.
pod 'Alamofire'
To install specific pod version, specify pod version after pod name.
pod 'Alamofire', '5.0.0'
Besides no version, or a specific one, it is also possible to use logical operators:
'> 0.1' Any version higher than 0.1
'>= 0.1' Version 0.1 and any higher version
'< 0.1' Any version lower than 0.1
'<= 0.1' Version 0.1 and any lower version
To install latest pod subversion of specified pod version :
pod 'Alamofire', '~> 0.1.2'
'~> 0.1.2' Version 0.1.2 and the versions up to 0.2, not including 0.2 and higher
'~> 0.1' Version 0.1 and the versions up to 1.0, not including 1.0 and higher
'~> 0' Version 0 and higher, this is basically the same as not having it.
To use pod from a local machine folder path:
pod 'Alamofire', :path => '~/Documents/Alamofire'
Install pods from the remote master branch
pod 'Alamofire', :git => 'https://github.com/Alamofire/Alamofire.git'
Install pods from the remote specific branch
pod 'Alamofire', :git => 'https://github.com/Alamofire/Alamofire.git', :branch => 'dev'
Install pods from the specific tag on the remote branch
pod 'Alamofire', :git => 'https://github.com/Alamofire/Alamofire.git', :tag => '3.1.1'
Install pods from the specific commit on the remote branch
pod 'Alamofire', :git => 'https://github.com/Alamofire/Alamofire.git', :commit => '0f506b1c45'
To know more in details, check reference: Cocoa pods installation guideline
In your podfile, write :
pod 'podname', 'desired version'.
Close the Project
Run pod update or pod install (as applicable) to get the pods as mentioned in above step.
Compile the code with your desired pod version.
Use platform :ios, '8.0'. It will automatically install the previous one which will run on this platform