TestsTested | ✗ |
LangLanguage | Obj-CObjective C |
License | BSD |
ReleasedLast Release | Sep 2015 |
Maintained by Uninstall.
Uninstall SDK (http://uninstall.io) helps you to understand the reasons for your app uninstalls, reduce the uninstall rate using a powerful predictive engine and also get app Re-installs through a unique actionable channel.
This guide will provide you step by step details on how to integrate the SDK in just a few minutes. Following steps outline the integration process in details.
Clone this repository
git clone https://github.com/uninstallio/ios-sdk.git
or download the zipped package.
wget https://github.com/uninstallio/ios-sdk/archive/master.zip
Unzip the files (if downloaded as a zip).
Add the files from All Targets in Builds directory to your project. If you are unfamiliar with the process of adding external libraries to your project.
a. Right click anywhere on the project navigator pane and select Add Files to "Your project" menu
b. Choose the Builds and then the All Targets folder. Select the file "libNotifyManager.a" and Folder "include" and click on "Add"
a. Click on your project folder on the project navigator pane and go to "Build Phases" Tab
b. Expand the "Link Binary With Library" pane.
c. Click on the '+' button and select
and click "Add"
Uninstall needs some background capabilities. You need to specify that you’ll use these feature in the UIBackgroundModes key in your info plist. We need the following list of permissions
The easiest way to do this is to use the new Capabilities tab in Xcode 5’s project editor, which includes a Background Modes section for easy configuration of multitasking options as shown below.
Alternatively, you can edit the key manually:
<key>UIBackgroundModes</key>
<array>
<string>fetch</string>
<string>remote-notification</string>
</array>
You would also need to add the following device capability in the info plist file.
<key>UIRequiredDeviceCapabilities</key>
<array>
<string>location-services</string>
</array>
Once the permissions are set, we can change the code as shown below.
"NotifyManager.h" to your app delegate
[[NotifyManager sharedManager] processLaunchOptions:launchOptions];
[[NotifyManager sharedManager] startNotifyServicesWithAppID:@"appToken" key:@"appSecret"];
if ([[UIApplication sharedApplication] respondsToSelector:@selector(registerUserNotificationSettings:)])
{
[[UIApplication sharedApplication] registerForRemoteNotifications];
UIUserNotificationSettings *settings = [UIUserNotificationSettings settingsForTypes:(UIUserNotificationTypeBadge | UIUserNotificationTypeSound | UIUserNotificationTypeAlert) categories:nil];
[[UIApplication sharedApplication] registerUserNotificationSettings:settings];
} else
{
[[UIApplication sharedApplication] registerForRemoteNotificationTypes: (UIRemoteNotificationTypeBadge | UIRemoteNotificationTypeSound | UIRemoteNotificationTypeAlert)];
}
To the method
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:
(NSDictionary *)launchOptions
In your app delegate.
Note: If you do not have the token and secret then please drop a mail to [email protected] to get these credentials for your app.
[[NotifyManager sharedManager] startNotifyServicesWithAppID:@"appToken"
key:@"appSecret"];
To the method
- (void)applicationWillEnterForeground:(UIApplication *)application
In your app delegate.
[[NotifyManager sharedManager] registerForPushNotificationUsingDeviceToken:deviceToken];
to the method
-(void) application:(UIApplication *)application didRegisterForRemoteNotificationsWithDeviceToken:(NSData *)deviceToken
[[NotifyManager sharedManager] processRemoteNotification:userInfo];
completionHandler(UIBackgroundFetchResultNewData);
to the method
- (void) application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo
fetchCompletionHandler:(void (^)(UIBackgroundFetchResult))completionHandler
[[NotifyManager sharedManager] startNotifyServicesWithAppID:@"appToken" key:@"appSecret"];
completionHandler(UIBackgroundFetchResultNoData);
to the method
- (void) application:(UIApplication *)application performFetchWithCompletionHandler:(void (^)(UIBackgroundFetchResult))completionHandler
[[NotifyManager sharedManager] didLoseFocus];
to the method
- (void)applicationDidEnterBackground:(UIApplication *)application
If you need to send us some events then you would need to do the additional steps as shown below.
Pass the Unique System User ID and Email Id to our SDK. This data will be used to synchronize the ID’s between our systems and also to take certain actions. This information has to be passed only once in the lifetime of the app. Help code snippet below.
NSUserDefaults* preferences = [NSUserDefaults standardUserDefaults];
NSString* isFirstTimeInstall = @"isFirstTimeInstall";
if([preferences objectForKey: isFirstTimeInstall] == nil)
{
[[NotifyManager sharedManager] identify:@"userId" traits:@{ @"name": @"User_Name",@"email": @"[email protected]" }];
}
else
{
const BOOL presentLevel = [preferences boolForKey: isFirstTimeInstall];
}
NSUserDefaults* preferences = [NSUserDefaults standardUserDefaults];
NSString* isFirstTimeInstall = @"isFirstTimeInstall";
const NSInteger presentLevel = ...;
[preferences setBool:presentLevel forKey:isFirstTimeInstall];
const BOOL didSave = [preferences synchronize];
All app events have to be passed to our SDK. Information can be passed in two ways:
If you use any third party analytics platform and supports data extraction via API, then send us the API keys and we will directly extract the information from there. Please check with your product/marketing manager for details on 3rd party platform.
In case you do not use any 3rd party platform or the platform doesn’t support any API then pass the data to our SDK via our event-capturing feature. Help code snippet below.
[[NotifyManager sharedManager] track:@"eventName" properties:@{ @"eventValue": @"Event-Value",@"IDSync": @"ABC1234"}];
In the Apple Developer Members Center, click on Identifiers under iOS Apps and locate your application in the list. Click on that app which you want to configure. If Push Notifications is disabled (as shown below)
then click on Edit which will show you something like this.
Ensure that the checkbox against Push Notifications is checked.
If you need to enable the Development or Production Push SSL Certificate, choose which certificate to create:
After clicking Create Certificate, you will see the Add iOS Certificate Assistant. Follow the instructions in the assistant and then click Continue.
Using the Certificate Signing request that was just created generate the APNS Push SSL certificate.
Once the Download button appears, you are ready to download. You may need to reload the page for this to update. Download the created certificate.
Open the certificate. Opening the certificate will open Keychain Access.
In Keychain Access your certificate should be shown under “My Certificates”. The name will be like Apple Development IOS Push Services:*xxxxxxxx
Select the certificate that was just added to Keychain Access and select File -> Export Items... from the menu. When saving the file, use the Personal Information Exchange (.p12) format.
The certificate file is ready. Please email it to us.
Having trouble with integration? Please contact us at [email protected] and we’ll help you sort it out in a jiffy.