Page tree
Skip to end of metadata
Go to start of metadata

 

PushAppsManager

The PushAppsManager instance is the main object and the most important one. PushAppsManager is an object which manages the initial registration to push notification services with apple, manages the ongoing flow of notifications and is used as a "helper object" to retrieve data on notifications and the device itself. All communication which one would like to perform with the PushApps SDK is enabled with PushAppsManager object.

Initialization

Initializing an instance of PushAppsManager is done with a method that returns a shared instance of PushAppsManager. You do not need to save an instance of PushAppsManager as a class property, and the shared instance is thread-safe. Typically, the first call that will initialize an instance of PushAppsManager will be inapplication:didFinishLaunchingWithOptions:

+ (PushAppsManager *)sharedInstance;

TypeNameDescription
PushAppsManagerpushAppsManageran Instance of PushAppsManager

 

Example:

Initializing PushAppsManager

 

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
#import <PushApps/PushApps.h>
 
@implementation ClassName
 
- (void)firstMethodName
{
    // this action will initialize a shared instance of PushAppsManager
    PushAppsManager *manager = [PushAppsManager sharedInstance];
}
 
- (void)secondMethodName
{
    // this action will initialize a shared instance of PushAppsManager
    [PushAppsManager sharedInstance];
}

 

Registration

Here are described the methods to register and unregister a device from PushApps Push Notification Services.

Register Device

Initial Registration

Within the PushApps SDK, Registration plays two roles in handling push notifications. The first is the initial registration to push notification services, and the second is handling received notifications. Registering for PushApps Push Notification services is done by providing the unique token as the first argument, and handling to push notifications received is done by passing the launchOptions dictionary. The handling of a push notification will update the notification status and will mark it as read. This indicates that a user opened the app by swiping or selecting the Push Notification.

- (void)startPushAppsWithAppToken:(NSString *)appToken withLaunchOptions:(NSDictionary *)launchOptions;
TypeNameDescription
NSStringappToken

an NSString object that represents the app token

NSDictionarylaunchOptionsan NSDictionary object which is passed as an argument in the AppDelegate.m method: application:didFinishLaunchingWithOptions:

 

Example:

Registering to PushApps

 

1
2
3
4
5
6
7
8
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
    // 1.
    // register to PushApps & handle a remote notification.
    [[PushAppsManager sharedInstance] startPushAppsWithAppToken:@"999-a-long-string-representing-a-token-999" withLaunchOptions:launchOptions];
     
    return YES;
}

 

Attention

Icon

Though registration happens only once, this method also handles received Push Notification, which means that when ever a Push Notification is received, the launchOptions dictionary must be passed to the method.

 

Initial Registration With Custom ID

 

This Registration method is extremely similar to the registration method above, but it adds a custom ID to a device, which allows you to have another ID for the device, alongside the unique device ID which PushApps provides.

- (void)startPushAppsWithAppToken:(NSString *)appToken withLaunchOptions:(NSDictionary *)launchOptions andCustomId:(NSString *)customId;
TypeNameDescription
NSStringappTokenan NSString object that represents the app token
NSDictionarylaunchOptionsan NSDictionary object which is passed as an argument in the AppDelegate.m method: application:didFinishLaunchingWithOptions:
NSStringcustomIdan NSString object which represents a custom ID which the developer provides.

 

Updating Registration

After the Initial registration accrues, PushApps SDK handles the registration process with Apple, and when all is OK, a delegation method in the Application's AppDelegate is called. The method is: application:didRegisterForRemoteNotificationsWithDeviceToken which notifies us that a successful registration was finished. This is the time to update the DeviceToken data.

- (void)updatePushToken:(NSData *)data;
TypeNameDescription
NSDatadata

an NSData object that represents the device token

Example:

Updating Device Token

 

1
2
3
4
5
6
- (void)application:(UIApplication *)application didRegisterForRemoteNotificationsWithDeviceToken:(NSData *)deviceToken
{
    // 1.
    // notify PushApps of a successful registration.
    [[PushAppsManager sharedInstance] updatePushToken:deviceToken];
}

 

Attention

Icon

This is a critical method which is required to finish the registration process. Since a Push Token may change, it is extremely important to keep PushApps up to date with a new Push Token, otherwise PushApps would not be able to deliver Push Notifications after changes to the Push Token. 

Unregister Device

To unregister a device from PushApps Push notification services we will need to specify a device ID which is identified with a device that is eligible to receive Push notifications.

- (void)unregisterFromPushNotifications;

 

Example:

Unregister a device

 

1
2
3
4
5
6
- (void)someMethodToUnregisterADevice
{
    // 1.
    // unregister a device from PushApps.
    [[PushAppsManager sharedInstance] unregisterFromPushNotifications];
}

 

Notifications

Notofications are objects that are sent to tha application and we are notified about them via the AppDelegate. This is why we use the AppDelegate to implement the PushApps SDK.

Handle Push Notifications

Handling of Push Notifications is done with two methods. We have already implemented the first method in the Initial Registration, which also deals with received Push Notification. The second method that handles Push Notification is handlePushMessageOnForeground:. a Developer should implement this method within the AppDelegate following method: application:didReceiveRemoteNotification. The handling of a push notification will update the notification status and will mark it as read. This indicates that a user opened the app by swiping or selecting the Push Notification.

- (void)handlePushMessageOnForeground:(NSDictionary *)launchOptions;
TypeNameDescription
NSDictionarylaunchOptions

an NSDictionary that represent a Push Notification

Example:

Handling Push Notifications

 

1
2
3
4
- (void)application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo
{
    [[PushAppsManager sharedInstance] handlePushMessageOnForeground:userInfo];
}

 

Clear Notifications Badge

Clearing a notification badge is a utility method provided by PushApps SDK for ease of use. As it name implies, it will clear the application badge which is visible to the user at the home screen of the device.

- (void)clearApplicationBadge;
No parameters.

Example:

Clear Application Badge Icon

 

1
2
3
4
- (void)methodWhereWeWantToClearApplicationBadge
{
    [[PushAppsManager sharedInstance] clearApplicationBadge];
}

 

Attention

Icon

This method clears Application badge entirely.

Update Notification Status

Updating a Push Notification status is the option to mark a sent Push Notification as read. Typically, it is of the developer interest to keep track of which users, and how many users open and read Push Notifications sent to their devices. But, not all Push Notifications need to be marked as read, since PushApps SDK takes care of some of these issues when a user chooses to enter the application by swiping or touching a Push Notification. For example, if a device received a Push Notification, and the user choses to ignore the Push Notification, and open the application by touching the application icon from the home screen, PushApps SDK will not mark the Push Notification as read, and the developers will need to handle this scenario by them selfs.

- (void)updateNotificationReadStatus:(NSDictionary *)options;
TypeNameDescription
NSDictionaryoptions

an NSDictionary that represent a Push Notification that contains an "Id" key with an NSNumber value which represents the Push Notification ID.

Example:

Update Push Notification Status

 

1
2
3
4
5
6
- (void)someMethod
{  
    // in this example, we manually enter a Push Notifiaction ID. you may provide the 'launchOptions' or the 'userInfo' from the app delegate methods, but the SDK already takes care of these situations.
    // this example assumes an app like 'whatsapp', that needs to handle multiple Push Notifications which are received in various states.
    [[PushAppsManager sharedInstance] updateNotificationReadStatus:@{@"Id" : @(123)}];
}

 

Push Token

a Push Token, or a Device Push Token, or Apple Push Token is a temporary unique identifier provided by Apple per application per device. The Push Token can change from time to time by Apple, and we can not control it.A Push Token enables Apple and PushApps to deliver a Push Notification to a device of your choice. There is no need to know, or save the Push Token to the device or to any other remote server, since it is only used by Apple and later on by PushApps to deliver a Push Notification to a particular device.

Attention

Icon

The PushApps SDK method: updatePushToken: is extremely crucial to keep your application up to date with Apple's push token. Therefore it is important to call the previous method in: application:didRegisterForRemoteNotificationsWithDeviceToken:, so that the Push Token will continue to update.

PushApps Delegate Protocol

PushAppsManager object has a delegation protocol. The protocol is called PushAppsDelegate and it is responsible to notify it's delegate on operations that took place. Registering as a delegate to the PushAppsManager protocol is not mandatory, and all of it's delegation methods are optional.

- (void)setDelegate:(id <PushAppsDelegate> )delegate;
TypeNameDescription
id <PushAppsDelegate>delegate

an object that conforms to PushAppsDelegate protocol

Example:

Register as Delegate

 

1
2
3
// 1.
// register as PushApps delegate.
[[PushAppsManager sharedInstance] setDelegate:self];

 

PushAppsDelegate Methods

PushAppsDelegate methods are triggered when ever an event accrued that requires notifying.

pushApps:didUpdateUserToken

This method is triggered when a successful push token update accrued. The method enables the developer to inspect the pushToken generated in Apple's Push Notification servers.

- (void)pushApps:(PushAppsManager *)manager didUpdateUserToken:(NSString *)pushToken;
TypeNameDescription
PushAppsManagermanager

an instance of PushAppsManager

NSStringpushTokenan NSString representation of the device push token

Example:

DidUpdateUserToken

 

1
2
3
4
5
#pragma mark - PushAppsDelegate
- (void)pushApps:(PushAppsManager *)manager didUpdateUserToken:(NSString *)pushToken
{
    NSLog(@"This is your push notification token = %@", pushToken);
}

 

pushApps:didReceiveRemoteNotification:whileInForeground

This method is triggered when a Push Notification is received by the device. It is the most important method for a developer who wishes to perform a specific action based on a received Push Notification. This method enables the developer to decided which type of action to perform according to the device state, in foreground or in background and extract important information passed in the Push Notification dictionary. Within this method the developer should customize the behavior of the application regarding the push notification, since it will provide valuable info regarding the state of the device when the push Notification was received and valuable information regarding the push Notification itself. PushApps platform enables you to send a custom JSON object inside the the push notification dictionary, so this is the best time to use it.

- (void)pushApps:(PushAppsManager *)manager didReceiveRemoteNotification:(NSDictionary *)pushNotification whileInForeground:(BOOL)inForeground:
TypeNameDescription
PushAppsManagermanager

an instance of PushAppsManager

NSDictionarypushNotificationan NSDictionary representation of a Push notification
BOOLinForegrounda BOOL primitive indicating the application state status when a Push Notification was received

Example:

didReceiveRemoteNotification

 

1
2
3
4
5
6
7
8
9
10
11
12
13
#pragma mark - PushAppsDelegate
 
- (void)pushApps:(PushAppsManager *)manager didReceiveRemoteNotification:(NSDictionary *)pushNotification whileInForeground:(BOOL)inForeground
{
    if (inForeground) {
        // don't want to disturb the user, so we will save the notification, and display it when user launches the app.
        [[NSUserDefaults standardUserDefaults] setObject:pushNotification forKey:@"LastPushNotificationToDisplayWhenAppLaunchesAgain"];
        [[NSUserDefaults standardUserDefaults] synchronize];
    } else {
        // set the application badge icon dynamicly by taking the value from the pushNotification dictionary
        [UIApplication sharedApplication].applicationIconBadgeNumber = [pushNotification[@"aps"][@"badge"] integerValue]
    }
}

 

pushApps:registrationForRemoteNotificationFailedWithError:

This Method is triggered when the application's Delegate receives an error while trying to register for remote notifications, like when running an app from the simulator, or when the user did not approve push notifications. Delegate Method will provide an NSError object which will describe the error.

 

- (void)pushApps:registrationForRemoteNotificationFailedWithError:
TypeNameDescription
 NSErrorerroran NSError which represents an error

 

 

1
2
3
4
5
6
7
8
9
10
11
12
13
14

// updating Push Apps

- (void)application:(UIApplication *)application didFailToRegisterForRemoteNotificationsWithError:(NSError *)error
{
    [[PushAppsManager sharedInstance] updatePushError:error];
}

 

// getting notified

- (void)pushApps:(PushAppsManager *)manager registrationForRemoteNotificationFailedWithError:(NSError *)error

{

    NSLog(@"%@", [error description]);

}


Tags 

There will be a time when you will want to send a push notification to a group of users, with a common characteristics. In order to do that, the PushApps iOS SDK gives you the ability to mark users with a specific tag. For example: one's age. You can add as many tags as you want per user. For each, you'll need to supply the tag's identifier and the tag's value.

A set of tags and conditions between them creates a Segment, to learn more about Segments please refer to our Segmentation guide

There are 4 types of tags:

Through the SDK , You can send multiple tags at once.

A tag with the same identifier can only have a single data type.

Tag a date

- (void)addTagForDate:(NSDate *)date withIdentifierForTag:(NSString *)identifier andOperationStatus:(tagStatus)status;
TypeName

Description

NSDatedate

an NSDate representation of a date

NSStringidentifier

an NSString object which represents a tag name

void(^tagStatus)(BOOL success, NSString *msg)statusa type definition block, which notifies the status of the tag

Example:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
- (void)setUserBirthday:(NSDate *)birthday
{
    [[PushAppsManager sharedInstance] addTagForDate:birthday withIdentifierForTag:@"User_Birthday" andOperationStatus:^(BOOL success, NSString *msg) {
        if (success) {
            NSLog(@"we have just successfuly tagged a user birthday!");
        } else {
            // check what is the problem.
            NSLog(@"%@", msg);
        }
    }];
}

Tag dates

- (void)addTagForDates:(NSArray *)dates andOperationStatus:(tagStatus)status;
TypeName

Description

NSArraydates

an NSArray object, containing key-value objects of type NSDate

void(^tagStatus)(BOOL success, NSString *msg)statusa type definition block, which notifies the status of the tag
Example:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
- (void)aMethodThatCollectsDataForReminders:(NSArray *)reminders
{
    // we assume that the reminders data looks like this:
    // reminders = @[[NSDate date], [NSDate date], [NSDate date], [NSDate date]];
    NSMutableArray *keyValueArrayOfDates = [[NSMutableArray alloc] init];
    // we will prepare the data in key-value format, so that we could pass data in a group.
    for (int i = 0; i < [reminders count]; i++) {
        // give every ualue a different tag
        NSString *tag = [NSString stringWithFormat:@"tag%i", i];
        [keyValueArrayOfDates addObject:@{tag : reminders[i]}];
    }
    // once the data of dates is ready, we will pass it.
    [[PushAppsManager sharedInstance] addTagForDates:keyValueArrayOfDates andOperationStatus:^(BOOL success, NSString *msg) {
        if (success) {
            NSLog(@"we have just successfuly tagged a user event");
        } else {
            // check what is the problem.
            NSLog(@"%@", msg);
        }
    }];
}

Attention

Following explanations contains similar declarations like  'key-value objects of type NSDate'. For clarification purposes, This means that the NSArray object passed as an argument needs to be allocated and initialized with objects in a key-value coding manner. Keys must be of type NSString, and values must be of Apple Property List types.

To summarize, 'key-value objects of type NSDate' means an NSDictionary with an NSDate as value and an NSString as key.

Tag a String

- (void)addTagForString:(NSString *)string withIdentifierForTag:(NSString *)identifier andOperationStatus:(tagStatus)status;
TypeName

Description

NSStringstring

an NSStrings representation of a string

NSStringidentifier

an NSString object which represents a tag name

void(^tagStatus)(BOOL success, NSString *msg)statusa type definition block, which notifies the status of the tag

Example:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
- (void)addStringToTag:(NSString *)string
{
    // method will add a name tag
    [[PushAppsManager sharedInstance] addTagForString:string withIdentifierForTag:@"name" andOperationStatus:^(BOOL success, NSString *msg) {
        if (success) {
            NSLog(@"we have just successfuly added a tag");
        } else {
            // check what is the problem.
            NSLog(@"%@", msg);
        }
    }];
}

Tag Strings

- (void)addTagForStrings:(NSArray *)strings andOperationStatus:(tagStatus)status;
TypeName

Description

NSArraydates

an NSArray object, containing key-value objects of type NSString

void(^tagStatus)(BOOL success, NSString *msg)statusa type definition block, which notifies the status of the tag

Example:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
- (void)addStringsToTags
{
    // method will add a strings and tags
    [[PushAppsManager sharedInstance] addTagForStrings:@[@{@"name" : @"Arnold"}, @{@"family" : @"Schwarzenegger"}] andOperationStatus:^(BOOL success, NSString *msg) {
        if (success) {
            NSLog(@"we have just successfuly added tags");
        } else {
            // check what is the problem.
            NSLog(@"%@", msg);
        }
    }];
}

Tag a Number

- (void)addTagForNumber:(NSNumber *)number withIdentifierForTag:(NSString *)identifier andOperationStatus:(tagStatus)status;
TypeName

Description

NSNumbernumber

an NSNumber representation of a primitive integer.

NSStringidentifier

an NSString object which represents a tag name

void(^tagStatus)(BOOL success, NSString *msg)statusa type definition block, which notifies the status of the tag

Example:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
- (void)addUserAge:(NSInteger)age
{
    [[PushAppsManager sharedInstance] addTagForNumber:@(age) withIdentifierForTag:@"user_age" andOperationStatus:^(BOOL success, NSString *msg) {
        if (success) {
            NSLog(@"we have just successfuly added a tag");
        } else {
            // check what is the problem.
            NSLog(@"%@", msg);
        }
    }];
}

Tag Numbers

- (void)addTagForNumbers:(NSArray *)numbers andOperationStatus:(tagStatus)status;
TypeName

Description

NSArraydates

an NSArray object, containing key-value objects of type NSNumber

void(^tagStatus)(BOOL success, NSString *msg)statusa type definition block, which notifies the status of the tag

Example:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
- (void)refreshUserLikesQuantity:(NSArray *)likes
{
    // we assume that we want to collect numer of likes user does, per images, videos, etc.
    // so, likes looks like this: likes = @[@{@"likes_videos" : @(32)}, @{@"likes_images" : @(323)}];
    [[PushAppsManager sharedInstance] addTagForNumbers:likes andOperationStatus:^(BOOL success, NSString *msg) {
        if (success) {
            NSLog(@"we have just successfuly added tags");
        } else {
            // check what is the problem.
            NSLog(@"%@", msg);
        }
    }];
}

Tag a Boolean

- (void)addTagForBoolean:(BOOL)boolean withIdentifierForTag:(NSString *)identifier andOperationStatus:(tagStatus)status;
TypeName

Description

BOOLboolean

a primitive boolean.

NSStringidentifier

an NSString object which represents a tag name

void(^tagStatus)(BOOL success, NSString *msg)statusa type definition block, which notifies the status of the tag

Example:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
- (void)doesUserHasGooglePlusAccount:(BOOL)answer
{
    [[PushAppsManager sharedInstance] addTagForBoolean:answer withIdentifierForTag:@"hasGooglePlusAccount" andOperationStatus:^(BOOL success, NSString *msg) {
        if (success) {
            NSLog(@"we have just successfuly added a tag");
        } else {
            // check what is the problem.
            NSLog(@"%@", msg);
        }
    }];
}

Tag Booleans

- (void)addTagForBooleans:(NSArray *)booleans andOperationStatus:(tagStatus)status;
TypeName

Description

NSArraydates

an NSArray object, containing key-value wraped objects of type BOOL

void(^tagStatus)(BOOL success, NSString *msg)statusa type definition block, which notifies the status of the tag

Example:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
- (void)tagUserLikesAndDislikes:(NSArray *)likesAndDislike
{
    // we assume we are tagging movies that the use likes or dislikes.
    // so, likesAndDislike looks like this: likesAndDislike = @[@{@"StarWarsIV" : @(YES)}, @{@"MenInSpace" : @(NO)}, @{@"LordOfTheRings" : @(YES)}];
    [[PushAppsManager sharedInstance] addTagForBooleans:likesAndDislike andOperationStatus:^(BOOL success, NSString *msg) {
        if (success) {
            NSLog(@"we have just successfully added a tag");
        } else {
            // check what is the problem.
            NSLog(@"%@", msg);
        }
    }];
}

Remove a Tag

- (void)removeTagWithIdentifier:(NSString *)tagIdentifier andOperationStatus:(tagStatus)status;
TypeName

Description

NSStringidentifier

an NSString object which represents a tag name

void(^tagStatus)(BOOL success, NSString *msg)statusa type definition block, which notifies the status of the tag

Example:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
- (void)removeTagIdentifier:(NSString *)identifier
{
    [[PushAppsManager sharedInstance] removeTagWithIdentifier:identifier andOperationStatus:^(BOOL success, NSString *msg) {
        if (success) {
            NSLog(@"we have just successfully removed a tag");
        } else {
            // check what is the problem.
            NSLog(@"%@", msg);
        }
    }];
}

Remove Tags

- (void)removeTagsWithIdentifiers:(NSArray *)tagIdentifiers andOperationStatus:(tagStatus)status;
TypeName

Description

NSArraytagIdentifiers

an NSArray object, containing objects of Type NSString

void(^tagStatus)(BOOL success, NSString *msg)statusa type definition block, which notifies the status of the tag

Example:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
- (void)removeTagIdentifier:(NSArray *)identifiers
{
    // identifiers = @[@"identifier1", @"identifier2", @"....."];
    [[PushAppsManager sharedInstance] removeTagsWithIdentifiers:identifiers andOperationStatus:^(BOOL success, NSString *msg) {
        if (success) {
            NSLog(@"we have just successfuly added a tag");
        } else {
            // check what is the problem.
            NSLog(@"%@", msg);
        }
    }];
}

 

General Properties

General properties does not indicate Objective-C style @property, but it is a general term for helper methods provided by PushApps SDK to help the developer easily retrieve information he or she needs to perform Push Notifications and PushApps SDK oriented actions.

Device Id

The Device ID is the device unique identifier (also know as UDID).

- (NSString *)getDeviceId;
TypeNameDescription
NSString 

an NSString representation of the device unique identifier (UDID)

Example:

Device ID

 

1
2
3
4
5
6
7
8
9
10
11
- (void)methodWhereWeWantToUnregisterFromRemoteNotifications
{  
    // instead of searching the device id, we can now use PushAppsManager to retrieve it.
    //[[PushAppsManager sharedInstance] unregisterFromPushNotificationsByDeviceId:@"999-some-unique-UDID-string-representaion-999"];
     
    // retrive the device ID and unregister the device
    NSString *deviceId = [[PushAppsManager sharedInstance] getDeviceId];
 
    // or in "one liner" style
    [[PushAppsManager sharedInstance] unregisterFromPushNotificationsByDeviceId:[[PushAppsManager sharedInstance] getDeviceId]];
}

 

Device Name

The Device name is the device public - commercial name, or in other words iPhone5s, Simulator or iPad2 etc. You can use this information to analyze statistics, and to make your life generally easier.

- (NSString *)getDeviceName
TypeNameDescription
NSString 

an NSString representation of the device public - commercial name

Example:

Device ID

 

1
2
3
4
- (void)someMethod
{  
    NSLog(@"Device name: %@", [[PushAppsManager sharedInstance] getDeviceName]);
}

 

SDK version

PushApps SDK version is a general information method that contains information about the SDK version number.

- (NSNumber *)getSDKVersion
TypeNameDescription
NSString 

an NSString representation of PushApps SDK version

Example:

Device ID

 

1
2
3
4
- (void)someMethod
{  
    NSLog(@"PushApps SDK version: %@", [[PushAppsManager sharedInstance] getSDKVersion]);
}

 

App version

The Application build-version-number string of the Application bundle

- (NSString *)getAppVersion
TypeNameDescription
NSString 

an NSString representation of the Application bundle version

Example:

Device ID

 

1
2
3
4
- (void)someMethod
{  
    NSLog(@"Application Bundle version: %@", [[PushAppsManager sharedInstance] getAppVersion]);
}

 

Clear Application Badge

This method will clear the application badge number. The method is provided as a convenience method, to quickly remove the application badge number. 

- (void)clearApplicationBadge
TypeNameDescription
  

clears the application badge number, as appears on the home screen

Example:

 

1
2
3
4
- (void)viewDidLoad
{  
    [super viewDidLoad];
        [ [PushAppshManager sharedInstance] clearApplicationBadge] ;
}

 

Are Push Notifications Enabled

This method provides a Boolean value indicating if the user did authorize the app to receive Push Notifications. 

- (BOOL)arePushNotificationsEnabled;
TypeNameDescription
Bool A Bollean value indicating if the user did authorize the app to use Push Notifications

Example:

 

1
2
3
4
5
6
7
8
9
10

- (void)pushApps:(PushAppsManager *)manager registrationForRemoteNotificationFailedWithError:(NSError *)error

{

    NSLog(@"%@", [error description]);

    if ([[PushAppsManager sharedInstance] arePushNotificationsEnabled]) {

        // if we failed to register, but the user approved notifications, perhaps the the app's provision profile is where the problem is.

    }

}

 

Custom ID

This Method returns the custom ID which the developer provided during registration. If the developer did not provide any custom ID, method will return nil.

- (NSString *)getCustomId;
TypeNameDescription
NSString 

an NSString representation of the custom ID which was inputted at registration