Getting Started
Use these set up instructions to configure the Bringg Driver SDK for iOS in your projects.
Overview
GitHub
See Bringg-iOS-DriverSDK in GitHub for the Bringg Driver SDK for iOS.
BringgDriverSDK
The Bringg Driver SDK for iOS is referred to as BringgDriverSDK.
Setting up your BringgDriverSDK project requires CocoaPods and the following steps:
- Adding the BringgDriverSDK in Your Podfile
- Enabling the Required Background Tasks
- Adding the Required Permissions to Your Info.plist
- Initializing the BringgDriverSDK to Your AppDelegate.Swift
Prerequisites
CocoaPods
If you are not already using, see CocoaPods.org for more information.
Setting Up the BringgDriverSDK In Your Project
Step 1. Adding the BringgDriverSDK to Your Podfile
To add the BringgDriverSDK to your project:
a. If your project is a new project, initialize Cocoapods.
$ pod init
b. Add the Driver SDK pod to your profile.
pod 'BringgDriverSDK', '1.7.0'
c. Optionally, allow web socket data usage logging by adding a fork of Starscream.
pod 'Starscream', :git => "https://github.com/bringg/Starscream", :branch => "feature/notification-center-data-usage"
d.. Execute the following command:
$ pod install
The following is an example Podfile:
platform :ios, '9.0'
use_frameworks!
target 'BringgDriverSDKExampleApp' do
pod 'BringgDriverSDK', '1.7.0'
# The next line is optional and allows logging socket data usage
pod 'Starscream', :git => "https://github.com/bringg/Starscream", :branch => "feature/notification-center-data-usage"
end
Step 2. Enabling the Required Background Tasks
To enable the required background tasks:
a. In your Xcode project's App Settings, click the Capabilities tab.
b. Enable the following background modes:
- Location updates
- Background fetch
Step 3. Adding the Required Permissions to Your Info.plist
To add the required permissions to Info.plist:
In your Xcode project's Info tab, add permission strings for the following:
- Privacy - Location Always and When In Use Usage Description
- Privacy - Location When In Use Usage Description
Step 4. Initializing the BringgDriverSDK in Your AppDelegate.Swift
Initialize The BringgDriverSDK
You must initialize the SDK before any of the actions on any of the controllers are called. Bringg suggests initializing the SDK in application(didFinishLaunchingWithOptions:)
Log Detailed Messages
Optionally, you can use LogReportsManager and initialize the BringgDriverSDK with a logger that conforms to the LoggerProtocol protocol. Your logger object will receive messages at the log levels you specify. The Bringg-iOS-DriverSDK repo includes an example logger using CocoaLumberjack.
To initialize BringgDriverSDK to your AppDelegate.swift:
a. Open the AppDelegate.swift file.
b. Add the following code:
import BringgDriverSDK
class AppDelegate: UIResponder, UIApplicationDelegate {
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
// Initialize Bringg SDK.
Bringg.initializeSDK()
}
}
That's All!
Updated over 4 years ago