...
- Xcode application with a base SDK of iOS 9 and above.
- Xcode application with a deployment target of iOS 7 and above.
- An account on the Appoxee dashboard with a configured application.
Procedure
1. Download the SDK from Github.
2. Drag AppoxeeSDK.framework into you project, or use cocoapods see link “add mobile push sdk”2“Add the Mobile Push SDK”
3. Open your AppDelegate.m file, and add the following import statement:
Code Block |
---|
#import <AppoxeeSDK/AppoxeeSDK.h> |
34. Add the following delegate notation (can also be added at AppDelegate.h):
...
Code Block |
---|
@interface AppDelegate() <AppoxeeDelegate><AppoxeeNotificationDelegate> @end |
45. Add the following implementation to the method named: application:didFinishLaunchingWithOptions:, Where, xxx.xxx represents the SDK ID. These were created for you with the Appoxee Dashboard.:
Code Block | ||
---|---|---|
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { [[Appoxee shared] engageWithLaunchOptions:launchOptions andDelegate:self andSDKID:@"xxx.xxx"]; // Insert other initialization code or other Frameworks code below. return YES; } | ||
Info | ||
| ||
Attention! you will still need to define Add AppManager to your App Code (Manual) file, if you need to configure your applications environment |
56. Add the following implementation to the method named: application:didRegisterForRemoteNotificationsWithDeviceToken:
...
Code Block |
---|
- (void)application:(UIApplication *)application didRegisterForRemoteNotificationsWithDeviceToken:(NSData *)deviceToken { [[Appoxee shared] didRegisterForRemoteNotificationsWithDeviceToken:deviceToken]; } |
67. Add the following implementation to the method named: application:didReceiveRemoteNotification:
Code Block |
---|
- (void)application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo { [[Appoxee shared] receivedRemoteNotification:userInfo]; } |
78. Add the following implementation to the method named: application:didRegisterUserNotificationSettings:
Code Block |
---|
- (void)application:(UIApplication *)application didRegisterUserNotificationSettings:(UIUserNotificationSettings *)notificationSettings { [[Appoxee shared] didRegisterUserNotificationSettings:notificationSettings]; } |
89. OPTIONAL STEP - To implement iOS8 'Push Actions', add the following implementation to the method named: application:handleActionWithIdentifier:forRemoteNotification:completionHandler:
Code Block |
---|
- (void)application:(UIApplication *)application handleActionWithIdentifier:(NSString *)identifier forRemoteNotification:(NSDictionary *)userInfo completionHandler:(void (^)())completionHandler { // Must be implemented in order to enable 'Push Actions'. BOOL didHandle = [[Appoxee shared] handleActionWithIdentifier:identifier forRemoteNotification:userInfo completionHandler:completionHandler]; if (!didHandle) { completionHandler(); } // Handle the action in case it is not handled by Appoxee. When done - completionHandler() must be called. } |
910. OPTIONAL STEP – Silent push
Please review the documentation provided with the SDK for the below methods :
Code Block |
---|
- handleActionWithIdentifier:forRemoteNotification:completionHandler: - didReceiveRemoteNotification:fetchCompletionHandler:andNotifyCompletionWithBlock: |
10. OPTIONAL STEP - To implement 'Deep Linking', 'Opening a View Controller', 'Open the App Store' and a website, add the following implementation to the method named: application:openURL:sourceApplication:annotation:
Code Block |
---|
- (BOOL)application:(UIApplication *)application openURL:(NSURL *)url sourceApplication:(NSString *)sourceApplication annotation:(id)annotation
{
BOOL handling = NO;
if ([sourceApplication isEqualToString:@"AppoxeeSDK"]) {
/*
Appoxee SDK will automatically try to handle all annotations. return 'NO' to indicate the Appoxee should handle the url, or 'YES' for taking over control.
Possible annotations from Appoxee: @"APXURL_scheme", @"APXWeb_Site", @"APXApp_Store", @"APXView_Controller"
*/
if ([annotation isEqualToString:@"APXURL_scheme"]) {
handling = YES;
// your implementation goes here.
} else {
handling = NO; // We will let Appoxee to handle the redirection for us.
}
}
return handling;
}
|
11. OPTIONAL STEP - Appoxee delegate:
Code Block |
---|
#pragma mark - AppoxeeDelegate - (void)Appoxee:(Appoxee *)appoxee handledRemoteNotification:(APXPushNotification *)pushNotification andIdentifer:(NSString *)actionIdentifier { // a push notification was recieved. } |