PushWizard iOS SDK Documentation 1.5.1

 PushWizard iOS SDK Documentation 1.5.1 PushWizard/Bitsmart Global LLC In this documentation we will provide you the exact code that you have to use to call the different functions in your
app. We also try to provide examples, where we think, it’s necessary. For more help not related to the SDK directly,
please visit the FAQ.
Warning! You will not be able to use Push if you build your app for the simulator! Push Service is only available for
device builds by original Apple design.
Warning! BEFORE you integrate the SDK and try to do anything else, you need to configure your app for Push
Notifications in the Provisioning Portal and AFTER that you have to create, recreate or edit your Provisioning
Profiles. Please see the tutorial video here: https://pushwizard.com/configureforpush
Warning! You must replace @”YOUR_APPKEY” with your real sandbox/live AppKey, which can be found on the
PushWizard website.
After unpacking the zip file, drop the libPushWizard folder into your project.
After you dropped the libPushWizard into your project, activate the checkbox next to “Copy items into destination
group's folder”. Otherwise you might get build errors.
Import the library header file into the AppDelegate.m file and implement the following functions:
#import "PushWizard.h"
#warning Replace YOUR_APPKEY with your AppKey from PushWizard
static NSString *kAppKey = @"YOUR_APPKEY";
#define SYSTEM_VERSION_GREATER_THAN_OR_EQUAL_TO(v) ([[[UIDevice currentDevice] systemVersion]
compare:v options:NSNumericSearch] != NSOrderedAscending)
Register the app for receiving Push Messages with this function:
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
if (SYSTEM_VERSION_GREATER_THAN_OR_EQUAL_TO(@"8.0")) {
UIUserNotificationSettings *settings = [UIUserNotificationSettings settingsForTypes:
(UIRemoteNotificationTypeAlert |
UIRemoteNotificationTypeBadge |
UIRemoteNotificationTypeSound) categories:nil];
[[UIApplication sharedApplication] registerUserNotificationSettings:settings];
}
else {
[[UIApplication sharedApplication] registerForRemoteNotificationTypes:
(UIRemoteNotificationTypeAlert |
UIRemoteNotificationTypeBadge |
UIRemoteNotificationTypeSound)];
}
NSDictionary *payload = [launchOptions valueForKey:UIApplicationLaunchOptionsRemoteNotificationKey];
if (payload) {
[self application:application didReceiveRemoteNotification:payload];
}
}
Call the start with this function:
- (void)application:(UIApplication *)application didRegisterForRemoteNotificationsWithDeviceToken:(NSData *)deviceToken
{
// You can send a custom NSArray with max 100 NSString values for later filtering
[PushWizard startWithToken:deviceToken andAppKey:kAppKey andValues:nil];
}
Helper Function:
- (void)application:(UIApplication *)application didRegisterUserNotificationSettings:(UIUserNotificationSettings
*)notificationSettings
{
//register to receive notifications
[application registerForRemoteNotifications];
}
Values in the startWithToken function are an optional array.
You can add max 100 strings, which you can filter on the website or in the API, when sending a push message.
If you don’t want to send strings, you must send a “nil” value.
You can’t set up more, than 100 strings. If so, it will be ignored by the SDK.
Example of a “5 string array”:
NSArray *arr = [[NSArray alloc] initWithObjects:@"yourvalue1", @"yourvalue2", @"yourvalue3", @"yourvalue4", @"yourvalue5", nil];
Values can be any words, numbers or combinations of both.
You can handle the incoming push message with this function:
- (void)application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo
{
// Necessary for handling special events, like URL Redirecting and Review Requests
[PushWizard handleNotification:userInfo];
}
To handle returning from background use this function:
- (void)applicationDidBecomeActive:(UIApplication *)application
{
[PushWizard updateSessionWithValues:nil];
}
Values in the updateSessionWithValues function are an optional array.
You can add max 100 strings, which you can filter on the website, when sending a push message.
If you don’t want to send strings, you must send a “nil” value.
You can’t set up more, than 100 strings. If so, it will be ignored by the SDK.
Example of a “5 string array”:
NSArray *arr = [[NSArray alloc] initWithObjects:@"yourvalue1", @"yourvalue2", @"yourvalue3", @"yourvalue4", @"yourvalue5", nil];
Values can be any words, numbers or combinations of both.
Use this function to handle running in the background:
- (void)applicationDidEnterBackground:(UIApplication *)application
{
[PushWizard endSession];
}
© 2015 PushWizard / Bitsmart Global LLC. All Rights Reserved.