Last version
sudo gem install cocoapods -n/usr/local/bin
Pre release version
sudo gem install cocoapods --pre -n/usr/local/bin
A list of useful pod and common issue with Cocoapods
# Pod configuration
platform :ios, "8.0"
use_frameworks! # for Swift project
def import_pods
#Core libraries
pod 'CocoaLumberjack'
pod 'AFNetworking', '~> 2.6.0'
#Object serializer
pod 'Mantle', '~> 2.0'
#Mobile Database
pod 'Realm', '~> 0.95'
#Table view swipe cell and table view empty view
pod 'SWTableViewCell', '~> 0.3'
pod 'DZNEmptyDataSet'
#Autolayout helper
pod 'Masonry', '~> 0.6'
#Detect Urls, #, @ and regex patterns on UILabel
#pod 'ResponsiveLabel', '~> 1.0.3'
pod 'TTTAttributedLabel', '~> 1.13'
#Collection of NSFormatter subclasses for colors, time, location and phone number
pod 'FormatterKit'
#Pull to refresh for table view and collection view
pod 'INSPullToRefresh', '~> 1.0'
...
#For development pod
#pod "LocalPod", :path => "development pod path"
end
target 'AppTarget' do
import_pods
end
target 'AppTargetTests' do
import_pods
end
Run pod lib create PodName
command to create the default template for a Pod. The setup process ask some question about the pod configuration. For more information Getting started.
To learn more about the template see Pod Template . To learn more about creating a new pod, see Making a Cocoapods.
A Podspec, or Spec, describes a version of a Pod library. One Pod, over the course of time, will have many Specs. It includes details about where the source should be fetched from, what files to use, the build settings to apply, and other general metadata such as its name, version, and description.
After the Podspec creation run pod spec lint
to check configuration errors:
Once you have a release ready you’ll need to make the corresponding tag. First run a quick pod lib lint
then create your tag and push it.
$ cd ~/code/Pods/NAME
$ edit NAME.podspec
# set the new version to 0.0.1
# set the new tag to 0.0.1
$ pod lib lint
$ git add -A && git commit -m "Release 0.0.1."
$ git tag '0.0.1'
$ git push --tags
First of all, you have to register your device to pod trunk with this command:
pod trunk register mario.red@cocoapods.org 'Mario Red' --description='macbook air'
Then validate your pod with:
pod lib lint NAME.podspec
Now send you pod to Cocoapods:
pod trunk push NAME.podspec
A list of common issue
[!] The `AppTests [Debug]` target overrides the `FRAMEWORK_SEARCH_PATHS` build setting defined in `Pods/Target Support Files/Pods-SlhashTests/Pods-SlhashTests.debug.xcconfig'. This can lead to problems with the CocoaPods installation
- Use the `$(inherited)` flag, or
- Remove the build settings from the target.
Solution: a “$(inherited)”
to FRAMEWORK_SEARCH_PATHS (App target => Build Settings Tab => Search for “Framework Search Path”
After pod update
undefined symbols for architecture arm64
Solution: Adding $(OTHER_LDFLAGS)
to the App target under “Other Linker Flags” got me through this
[!] The `App [Debug]` target overrides the `EMBEDDED_CONTENT_CONTAINS_SWIFT` build setting defined in `Pods/Target Support Files/Pods-App-Quotes.debug.xcconfig'. This can lead to problems with the CocoaPods installation
- Use the `$(inherited)` flag, or
- Remove the build settings from the target.
Solution: Search for “EMBEDDED_CONTENT_CONTAINS_SWIFT
on App build settings. Press the delete key on the item. (the item will change from bold to regular text)