Overview
I want to add a JSON Web Token llibrary library to my I am Rich application.
Prerequisite
...
xcode project.
Install Cocoapods
Code Block |
---|
> sudo gem install cocoapods Fetching: cocoapods-core-1.5.3.gem (100%) Successfully installed cocoapods-core-1.5.3 Fetching: cocoapods-downloader-1.2.1.gem (100%) Successfully installed cocoapods-downloader-1.2.1 Fetching: molinillo-0.6.6.gem (100%) Successfully installed molinillo-0.6.6 Fetching: atomos-0.1.3.gem (100%) Successfully installed atomos-0.1.3 Fetching: nanaimo-0.2.6.gem (100%) Successfully installed nanaimo-0.2.6 Fetching: xcodeproj-1.6.0.gem (100%) Successfully installed xcodeproj-1.6.0 Fetching: cocoapods-1.5.3.gem (100%) Successfully installed cocoapods-1.5.3 Parsing documentation for cocoapods-core-1.5.3 Installing ri documentation for cocoapods-core-1.5.3 Parsing documentation for cocoapods-downloader-1.2.1 Installing ri documentation for cocoapods-downloader-1.2.1 Parsing documentation for molinillo-0.6.6 Installing ri documentation for molinillo-0.6.6 Parsing documentation for atomos-0.1.3 Installing ri documentation for atomos-0.1.3 Parsing documentation for nanaimo-0.2.6 Installing ri documentation for nanaimo-0.2.6 Parsing documentation for xcodeproj-1.6.0 Installing ri documentation for xcodeproj-1.6.0 Parsing documentation for cocoapods-1.5.3 Installing ri documentation for cocoapods-1.5.3 Done installing documentation for cocoapods-core, cocoapods-downloader, molinillo, atomos, nanaimo, xcodeproj, cocoapods after 8 seconds 7 gems installed |
Add a Podfile
Create a new Podfile using the following command:Defining Podfile
Code Block |
---|
platform :ios, '8.0'
use_frameworks!
target 'I AM Rich' do
pod 'JSONWebToken'
end |
Running
...
> pod init |
This command will create a default Podfile like the following:
Code Block |
---|
# Uncomment the next line to define a global platform for your project
# platform :ios, '9.0'
target 'KeystoneSDKDemo' do
# Comment the next line if you're not using Swift and don't want to use dynamic frameworks
use_frameworks!
# Pods for KeystoneSDKDemo
pod 'JSONWebToken'
end |
Edit the Podfile and add you import using the pod 'library' syntax as depicted above.
Run pod install to download and add the pod to your project.
Code Block |
---|
> pod install |
You may have to update the repo
Code Block |
---|
> pod repo update |
Using a Podfile will require that you use open the code using the workspace instead of the project.
Code Block |
---|
> open KeystoneSDKDemo.xcworkspace |
References
Reference | URL |
---|---|
Cocoapods.org | https://cocoapods.org/ |