DeployGate SDK for iOS

To use advanced feature of DeployGate, you need to integrate SDK into your app.
Just adding single line of code and it's done.

First note that you may use basic features of DeployGate without installing the SDK. Once you drop your current app package onto DeployGate, you may download it through DeployGate immediately, watch how installation is going on the dashboard and further app updates can also be pushed over the air.

Installing the DeployGate SDK into your project enables powerful features, such as crash reporting, remote Logging, update notification and user authentication.

Since installing the DeployGate SDK is fairly simple, just add the iOS SDK file, insert one line to your application and it's done. We highly recommend you to use it.

without SDK with SDK
Over the Air Deploy
Download Report
Get Update Notification
Crash Report
App Boot Reporting
User Authorization
Remote Logging

Install from CocoaPods


Add to Podfile

Add the following line to Podfile and install
  pod "DeployGateSDK"
Under your project directory in command line:
  pod install

Download SDK Package And Install


1. Download DeployGate SDK

Download SDK
DeployGate SDK supports iOS 6 and above.

2. Unzip it and copy DeployGateSDK-X.X.X.embeddedframework to your project's Frameworks directory.

Add ios sdk framework

3. If you are not using SystemConfiguration.framework, please add it first.

Add systemconfiguration framework

Usage


1. Incorporate into your project's AppDelegate file

Open the AppDelegate class which contains UIApplicationDelegate protocol in Xcode. Import DeployGateSDK/DeployGateSDK.h file and add the following line to application:didFinishLaunchingWithOptions:method.

[[DeployGateSDK sharedInstance] launchApplicationWithAuthor:@"YOUR_USER_NAME" key:@"[target_application_api_key]"];

Actual YOUR_USER_NAME / YOUR_API_KEY are shown after login.

Please replace the API Key for each application to [target_application_api_key]. API Key is you can check in the detailed page of each application.


2. That's it!

Let's build and upload your app to DeployGate. Now you are ready to receive boot and crash report. If you want to use User Authorization and so on, please continue proceeding to next section.

You can specify which user is using your app with DeployGate SDK.

This feature allows you to notify the latest revision to users who can install your app..

In some cases, you may want to restrict app distribution only to users you explicitly allowed.

DeployGate SDK provides several functions to check if the user has a privilege to use your app, in other words, if the current DeployGate user has your app on the list.

Usage


1. Register Custom URL Scheme

Get Custom URL Scheme from App page in DeployGate.
Custom url scheme

Open your project in Xcode and setup the Custom URL Scheme at TARGETS -> Info -> URL Types.
Add ios url scheme

2. Turn user authorization on and setup

Please open AppDelegate class which contains UIApplicationDelegate protocol in Xcode and please replace the line added before in [Usage section 1.] of [How to Install] chapter with the following line. Turn user authorization on will make the app launch mobile safari to get user information when boot.

[[DeployGateSDK sharedInstance] launchApplicationWithAuthor:@"YOUR_USER_NAME" key:@"[target_application_api_key]" userInfomationEnabled:YES];

Please replace the API Key for each application to [target_application_api_key]. API Key is you can check in the detailed page of each application.


3. Pass user information to SDK

In order to use the user information got from safari, add the following line to AppDelegate's application:openURL:sourceApplication:annotation:

return [[DeployGateSDK sharedInstance] handleOpenUrl:url sourceApplication:sourceApplication annotation:annotation];

4. That's it

Now the app will check for update when boot, and userAuthorizationWithCompletionHandler: will check whether the user has privilege to use your app or not.

DeployGate provides Remote Log mechanism. In order to replace the default NSLog, please add the following line to precompiled header (.pch) file.

#define NSLog DGSLog

Below is an example for logging class name, method name and line number at the same time.

#define NSLog(__FORMAT__, ...) DGSLog((@"%s [Line %d] " __FORMAT__), __PRETTY_FUNCTION__, __LINE__, ##__VA_ARGS__)

DeployGate shows 'Remote Log' on 'Timeline' in a page for application you distributed. DeployGateSDK stores logs in an internal file and send it at the next launch.

DeployGate provides Crash Report mechanism. DeployGate iOS SDK uses PLCrashReporter. DeployGateSDK stores crash report in an internal file and send it at the next launch. Currently DeployGate doesn't symbolicate the crashreport. We will provide symbolication on deploygate.com in the future.

How to Symbolication


1. Get Crash Report

Send Crash Report automatically next launching app.
Show crashreport

You can download the crashreport on each device page.
Download crashreport


2. Prepare .dSYM file and symbolicatecrash

Get dSYM file from Organizer -> Archive
Dsym

Configure the path of 'symbolicatecrash'. 'symbolicatecrash' is on the following directory in Xcode 6.
/Applications/Xcode.app/Contents/SharedFrameworks/DTDeviceKitBase.framework/Versions/A/Resources/symbolicatecrash

In Xcode 5 or earlier.

/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/Library/PrivateFrameworks/DTDeviceKitBase.framework/Versions/A/Resources/symbolicatecrash

If you get the following error, You need to set 'DEVELOPER_DIR'.

Error: "DEVELOPER_DIR" is not defined at symbolicatecrash line 60.

export DEVELOPER_DIR="/Applications/Xcode.app/Contents/Developer/"

3. Execute Symbolicatecrash

execute symbolicatecrash to the crashreport and dSYM file.

symbolicatecrash [CRASH_REPORT] [DSYM_FILE]

Result symbolication


Ask questions, share your tips or help others at our forum.