This document provides information on CocoaPods, including how to install CocoaPods, create a Podfile to specify dependencies, run pod install to install dependencies, open the Xcode workspace, create Pod specs to publish libraries, and examples of Pod specs for the UrbanAirship library.
2. What are CocoaPods
Library dependency management system for
Objective C Applications
Ruby Based
Uses spec files to tell what code to download
and use
4. Create Podfile
vim Podfile platform :ios
pod 'RestKit', '0.10.3'
target :test do
link_with 'AppnameTests'
pod 'Kiwi', '1.1.0'
end
5. Run the Install
pod install
Open the Workspace created
C open appName.xcworkspace
Compile the project
6. Creating a Spec
pod spec create <name or git url>
Edit spec file
pod spec lint <name of spec file>
Copy spec to
~/.cocoapods/master/<AppName>/<versionNo>
Fork github.com/cocoapods/specs and add
folder as you did on the last step
Submit a pull request
7. Original UrbanAirship Spec
Pod::Spec.new do |s|
s.name = 'UrbanAirship-iOS-SDK'
s.version = '1.3.3'
s.license = 'BSD'
s.platform = :ios
s.summary = 'A simple way to integrate Urban Airship services into your iOS applications.'
s.homepage = 'https://github.com/urbanairship/ios-library'
s.author = { 'Urban Airship' => 'support@urbanairship.com' }
s.source = { :git => 'https://github.com/urbanairship/ios-library.git', :tag => 'v1.3.3' }
# Airship ships both UA-prefixed ASI and SBJson, as well as un-prefixed
# versions that are no longer used in the .xcodeproj.
files = FileList['Airship/**/*.{h,m,c}']
files.exclude(//asi-http-request//)
files.exclude(//json-framework//)
files.exclude(//google-toolbox-for-mac//)
s.source_files = files
s.libraries = 'z', 'sqlite3.0'
s.frameworks = 'CFNetwork', 'CoreGraphics', 'Foundation', 'MobileCoreServices',
'Security', 'SystemConfiguration', 'UIKit', 'CoreTelephony',
'StoreKit', 'CoreLocation'
end
8. Modified UrbanAirship Spec
Pod::Spec.new do |s|
s.name = 'UrbanAirship-iOS-SDK'
s.version = '1.3.3.1'
s.license = 'BSD'
s.platform = :ios
s.summary = 'A simple way to integrate Urban Airship services into your iOS applications.'
s.homepage = 'https://github.com/urbanairship/ios-library'
s.author = { 'Urban Airship' => 'support@urbanairship.com' }
s.source = { :git => 'https://github.com/urbanairship/ios-library.git', :tag => 'v1.3.3' }
# Airship ships both UA-prefixed ASI and SBJson, as well as un-prefixed
# versions that are no longer used in the .xcodeproj.
files = FileList['Airship/**/*.{h,m,c}']
files = files.exclude(//asi-http-request//)
files = files.exclude(//json-framework//)
files = files.exclude(//google-toolbox-for-mac//)
files = files.exclude(//Reachability.*/)
files = files.exclude(/miniunz.c/)
s.source_files = files
s.libraries = 'z', 'sqlite3.0'
s.frameworks = 'CFNetwork', 'CoreGraphics', 'Foundation', 'MobileCoreServices',
'Security', 'SystemConfiguration', 'UIKit', 'CoreTelephony',
'StoreKit', 'CoreLocation', 'MessageUI', 'MapKit'
s.dependency 'Reachability'
end
9. About Me
Allan Davis
Email: cajun.code@gmail.com
Twitter: @cajun_code