Message-ID: <197399886.602.1406942951731.JavaMail.confluence@centos6.5-prod> Subject: Exported From Confluence MIME-Version: 1.0 Content-Type: multipart/related; boundary="----=_Part_601_733685280.1406942951712" ------=_Part_601_733685280.1406942951712 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Content-Location: file:///C:/exported.html iOS Reference

iOS Reference

 

PushAppsManager

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

Initialization

Initializing an instance of PushAppsManager is done with a method that r= eturns a shared instance of PushAppsManager. You do not need to save an ins= tance of PushAppsManager as a class property, and the shared instance is th= read-safe. Typically, the first call that will initialize an instance of Pu= shAppsManager will be inapplicatio= n:didFinishLaunchingWithOptions:

+ (PushAppsManager *)sharedInst= ance;

Type Name Description
PushAppsManager pushAppsManager an 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 instan= ce of PushAppsManager
     PushAppsManager *manager =3D [PushAppsManager sha= redInstance];
}
 
- ( void )secondMethodName
{
     // this action will initialize a shared instan= ce of PushAppsManager
     [PushAppsManager sharedInstance];
}

 

Registration

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

Register Device<= /h3>

Initial Registration

Within the PushApps SDK, Registration plays two roles in handling push n= otifications. The first is the initial r= egistration to push notification services, and the second is&= nbsp;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 a= s read. This indicates that a user opened the app by swiping or selecting t= he Push Notification.

- (void)startPushAppsWithAppToken:= (NSString *)appToken withLaunchOptions:(NSDictionary *)launchOptions;
Type Name Description
NSString appToken

an NSString object that represe= nts the app token

NSDictionary launchOptions an NSDictionary object which is pa= ssed 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 didFini= shLaunchingWithOptions:(NSDictionary *)launchOptions
{
     // 1.
     // register to PushApps & handle a remote = notification.
     [[PushAppsManager sharedInstance] startPushAppsWi= thAppToken:@ "999-a-long-string-representing-a-token-999= "=20 withLaunchOptions:launchOptions];
     
     return=20 YES;
}

 

Attention

Icon

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

 

Initial Registration With Custom ID

 

This Registration method is extrem= ely similar to the registration method above, but it adds a custom ID to a device, which allows you to ha= ve another ID for the device, alongside the unique device ID which PushApps= provides.

- (void)startPushAppsWithAppToken:= (NSString *)appToken withLaunchOptions:(NSDictionary *)launchOptions andCus= tomId:(NSString *)customId;
Type Name Description
NSString appToken an NSString object that represents= the app token
NSDictionary launchOptions an NSDictionary object which is pa= ssed as an argument in the AppDelegate.m method: application:didFinishLaunchingWithOptions:
NSString customId an NSString object which represent= s a custom ID which the developer provides.

 

Updating Registration

After the Initial registration accrues, PushApps SDK handles the registr= ation process with Apple, and when all is OK, a delegation method in the Ap= plication's AppDelegate is called. The method is: application:didRegisterForRemoteNotificationsWithDevice= Token which notifies us that a successful registration was finished. Th= is is the time to update the DeviceToken data.

- (void)updatePushToken:(NSData *)= data;
Type Name Description
NSData data

an NSData object that represent= s the device token

Example:

Updating Device Token

 

1
2
3
4
5
6
- ( void )application:(UIApplication *)application didRegi= sterForRemoteNotificationsWithDeviceToken:(NSData *)deviceToken
{
     // 1.
     // notify PushApps of a successful registratio= n.
     [[PushAppsManager sharedInstance] upd= atePushToken:deviceToken];
}

 

Attention

Icon

This is a critical method which is required to finish the registration p= rocess. Since a Push Token may change, it is extremely important to keep Pu= shApps up to date with a new Push Token, otherwise PushApps would not be ab= le 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 eligi= ble to receive Push notifications.

- (void)unregisterFromPushNotifica= tionsByDeviceId:(NSString *)deviceID;
Type Name Description
NSString deviceID

an NSString object that represe= nts the device unique identifier

Example:

Unregister a device

 

1
2
3
4
5
6
- ( void )someMethodToUnregisterADevice
{
     // 1.
     // unregister a device from PushApps.
     [[PushAppsManager sharedInstance] unregisterFromP= ushNotificationsByDeviceId:@ "999-some-unique-UDID-string-representaion-= 999" ];
}

 

= Notifications

Notofications are objects that are sent to tha application and we are no= tified about them via the AppDelegate. This is why we use the AppDelegate t= o implement the PushApps SDK.

Handle Push Notifi= cations

Handling of Push Notifications is done with two methods. We have already= implemented the first method in the <= strong>Initial Registration, which al= so deals with received Push Notification. The second method that handles Pu= sh Notification is handlePushMessageOnForeground:. a Developer should imple= ment this method within the AppDelegate following method: application:didReceiveRemoteNotification. The handling of a pus= h 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 Pus= h Notification.

- (void)handlePushMessageOnForegro= und:(NSDictionary *)launchOptions;
Type Name Description
NSDictionary launchOptions

an NSDictionary that represent = a Push Notification

Example:

Handling Push Notifications

 

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

 

Clear Notification= s Badge

Clearing a notification badge is a utility method provided by PushApps S= DK 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] clearApplicatio= nBadge];
}

 

Attention

Icon

This method clears Application badge entirely.

Update Notification Status

Updating a Push Notification status is the option to mark a sent Push No= tification as read. Typically, it is of the developer interest to keep trac= k 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 e= xample, if a device received a Push Notification, and the user choses to ig= nore the Push Notification, and open the application by touching the applic= ation icon from the home screen, PushApps SDK will not mark the Push Notifi= cation as read, and the developers will need to handle this scenario by the= m selfs.

- (void)updateNotificationReadStat= us:(NSDictionary *)options;
Type Name Description
NSDictionary options

an NSDictionary that represent = a Push Notification that contains an "Id" key with an NSNumber va= lue 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 N= otifiaction ID. you may provide the 'launchOptions' or the 'userInfo' from = the app delegate methods, but the SDK already takes care of these situation= s.
     // this example assumes an app like 'whatsapp'= , that needs to handle multiple Push Notifications which are received in va= rious states.
     [[PushAppsManager sharedInstance] updateNotificat= ionReadStatus:@{@ "Id"=20 : @(123)}];
}

 

<= /span>Push Token

a Push Token, or a Device Push Token, or Apple Push Token is a temporary unique identifier provided by Apple per applica= tion 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 i= s only used by Apple and later on by PushApps to deliver a Push Notificatio= n to a particular device.

Attention

Icon

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

PushApps Delegate Protoc= ol

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

- (void)setDelegate:(id <PushAp= psDelegate> )delegate;
Type Name Description
id <PushAppsDelegate> delegate

an object that conforms to Push= AppsDelegate protocol

Example:

Register as Delegate

 

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

 

PushAppsDelegate Methods

PushAppsDelegate methods are triggered when ever an event accrued that r= equires notifying.

pushApps:didUpdateUserToken

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

- (void)pushApps:(PushAppsManager = *)manager didUpdateUserToken:(NSString *)pushToken;
Type Name Description
PushAppsManager manager

an instance of PushAppsManager<= /p>

NSString pushToken an NSString representation of the = device push token

Example:

DidUpdateUserToken

 

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

 

pushApps:didReceiveRemoteNotification:whileInFo= reground

This method is triggered when a Push Notification is received by the dev= ice. It is the most important method for a developer who wishes to perform = a specific action based on a received Push Notification. This method enable= s the developer to decided which type of action to perform according to the= device state, in foreground or in background and extract important informa= tion passed in the Push Notification dictionary. Within this method the dev= eloper should customize the behavior of the application regarding the push = notification, since it will provide valuable info regarding the state of th= e device when the push Notification was received and valuable information r= egarding the push Notification itself. PushApps platform enables you to sen= d 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 whi= leInForeground:(BOOL)inForeground:
Type Name Description
PushAppsManager manager

an instance of PushAppsManager<= /p>

NSDictionary pushNotification an NSDictionary representation of = a Push notification
BOOL inForeground a BOOL primitive indicating the ap= plication 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 didReceiveRe= moteNotification:(NSDictionary *)pushNotification whileInForeground:( BOOL )inForeground
{
     if=20 (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:@ "LastPushNotificationToDisplayWhenAppLaunch= esAgain" ];
        = [[NSUserDefaults standardUserDefaults] synchroniz= e];
     } else=20 {
        = // set the application badge icon dynamicly by= taking the value from the pushNotification dictionary
        = [UIApplication sharedApplication].applicationIcon= BadgeNumber =3D [pushNotification[@ "aps" ][@ "badge" ] integerValue]
     }
}

 

pushApps:registration= ForRemoteNotificationFailedWithError:

This Method is triggered when the application's Delegate receives an err= or 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 er= ror.

 

- (void)pushApps:registrationForRemoteNotificationFailedWithError:=
Type Name Description
 NSError error an NSError which represents an err= or

 

 

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

// updating Push Apps

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

 

// getting notified

- (void)pushApps:(PushAppsManager *)manager registrationForRemoteNotific= ationFailedWithError:(NSError *)error

{

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

}

 

Tags<= /span> 

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, t= he 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. Fo= r 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 mo= re about Segments please re= fer to our Segmentation guide

There are 4 types of tags:

Through the SDK , You can send multip= le tags at once.

=20
=20 Icon=20
=20

A tag with the same identifier can on= ly have a single data type.

=20
=20
=20

Tag a date

- (void)addTagForDate:(NSDate *)da= te withIdentifierForTag:(NSString *)identifier andOperationStatus:(tagStatu= s)status;
Type Name

Description

NSDate date

an NSDate representation of a d= ate

NSString identifier

an NSString object which repres= ents a tag name

void(^tagStatus)(BOOL success, NSS= tring *msg) status a type definition block, which not= ifies 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 withIdentifier=
ForTag:@"User_Birthday" andOperationStatus:^(BOOL success, NSStri=
ng *msg) {
       =20
        if (success) {
           =20
            NSLog(@"we have just successfuly tagged a user birthday!&q=
uot;);
        } else {
           =20
            // check what is the problem.
            NSLog(@"%@", msg);
        }
    }];
}

Tag dates

- (void)addTagForDates:(NSArray *)= dates andOperationStatus:(tagStatus)status;
Type Name

Description

NSArray dates

an NSArray object, containing k= ey-value objects of type NSDate

void(^tagStatus)(BOOL success, NSS= tring *msg) status a type definition block, which not= ifies 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 =3D @[[NSDate date], [NSDate date], [NSDate date], [NSDate=
 date]];
   =20
    NSMutableArray *keyValueArrayOfDates =3D [[NSMutableArray alloc] init];
   =20
    // we will prepare the data in key-value format, so that we could pass =
data in a group.
    for (int i =3D 0; i < [reminders count]; i++) {
       =20
        // give every ualue a different tag
        NSString *tag =3D [NSString stringWithFormat:@"tag%i", i]=
;
       =20
        [keyValueArrayOfDates addObject:@{tag : reminders[i]}];
    }
   =20
    // once the data of dates is ready, we will pass it.
    [[PushAppsManager sharedInstance] addTagForDates:keyValueArrayOfDates a=
ndOperationStatus:^(BOOL success, NSString *msg) {
       =20
        if (success) {
           =20
            NSLog(@"we have just successfuly tagged a user event"=
);
        } else {
           =20
            // check what is the problem.
            NSLog(@"%@", msg);
        }
    }];
}
=20
=20

Attention

=20 Icon=20
=20

Following explanations contains similar declarations like  'key-val= ue 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 w= ith an NSDate as value and an NSString as key.

=20
=20
=20

Tag a String

- (void)addTagForString:(NSString = *)string withIdentifierForTag:(NSString *)identifier andOperationStatus:(ta= gStatus)status;
Type Name

Description

NSString string

an NSStrings representation of = a string

NSString identifier

an NSString object which repres= ents a tag name

void(^tagStatus)(BOOL success, NSS= tring *msg) status a type definition block, which not= ifies 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 withIdentifier=
ForTag:@"name" andOperationStatus:^(BOOL success, NSString *msg) =
{
       =20
        if (success) {
           =20
            NSLog(@"we have just successfuly added a tag");
        } else {
           =20
            // check what is the problem.
            NSLog(@"%@", msg);
        }
    }];
}

Tag Strings

- (void)addTagForStrings:(NSArray = *)strings andOperationStatus:(tagStatus)status;
Type Name

Description

NSArray dates

an NSArray object, containing k= ey-value objects of type NSString

void(^tagStatus)(BOOL success, NSS= tring *msg) status a type definition block, which not= ifies 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
   =20
    [[PushAppsManager sharedInstance] addTagForStrings:@[@{@"name"=
; : @"Arnold"}, @{@"family" : @"Schwarzenegger&quo=
t;}] andOperationStatus:^(BOOL success, NSString *msg) {
       =20
        if (success) {
           =20
            NSLog(@"we have just successfuly added tags");
        } else {
           =20
            // check what is the problem.
            NSLog(@"%@", msg);
        }
    }];
}

Tag a Number

- (void)addTagForNumber:(NSNumber = *)number withIdentifierForTag:(NSString *)identifier andOperationStatus:(ta= gStatus)status;
Type Name

Description

NSNumber number

an NSNumber representation of a= primitive integer.

NSString identifier

an NSString object which repres= ents a tag name

void(^tagStatus)(BOOL success, NSS= tring *msg) status a type definition block, which not= ifies 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) withIdentifier=
ForTag:@"user_age" andOperationStatus:^(BOOL success, NSString *m=
sg) {
       =20
        if (success) {
           =20
            NSLog(@"we have just successfuly added a tag");
        } else {
           =20
            // check what is the problem.
            NSLog(@"%@", msg);
        }
    }];
}

Tag Numbers

- (void)addTagForNumbers:(NSArray = *)numbers andOperationStatus:(tagStatus)status;
Type Name

Description

NSArray dates

an NSArray object, containing k= ey-value objects of type NSNumber

void(^tagStatus)(BOOL success, NSS= tring *msg) status a type definition block, which not= ifies 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 imag=
es, videos, etc.
    // so, likes looks like this: likes =3D @[@{@"likes_videos" :=
 @(32)}, @{@"likes_images" : @(323)}];
   =20
    [[PushAppsManager sharedInstance] addTagForNumbers:likes andOperationSt=
atus:^(BOOL success, NSString *msg) {
       =20
        if (success) {
           =20
            NSLog(@"we have just successfuly added tags");
        } else {
           =20
            // check what is the problem.
            NSLog(@"%@", msg);
        }
    }];
}

Tag a Boolean

- (void)addTagForBoolean:(BOOL)boo= lean withIdentifierForTag:(NSString *)identifier andOperationStatus:(tagSta= tus)status;
Type Name

Description

BOOL boolean

a primitive boolean.

NSString identifier

an NSString object which repres= ents a tag name

void(^tagStatus)(BOOL success, NSS= tring *msg) status a type definition block, which not= ifies 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 withIdentifie=
rForTag:@"hasGooglePlusAccount" andOperationStatus:^(BOOL success=
, NSString *msg) {
       =20
        if (success) {
           =20
            NSLog(@"we have just successfuly added a tag");
        } else {
           =20
            // check what is the problem.
            NSLog(@"%@", msg);
        }
    }];
}

Tag Booleans

- (void)addTagForBooleans:(NSArray= *)booleans andOperationStatus:(tagStatus)status;
Type Name

Description

NSArray dates

an NSArray object, containing k= ey-value wraped objects of type BOOL

void(^tagStatus)(BOOL success, NSS= tring *msg) status a type definition block, which not= ifies 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 =3D @[@{@"=
StarWarsIV" : @(YES)}, @{@"MenInSpace" : @(NO)}, @{@"Lo=
rdOfTheRings" : @(YES)}];
   =20
    [[PushAppsManager sharedInstance] addTagForBooleans:likesAndDislike and=
OperationStatus:^(BOOL success, NSString *msg) {
       =20
        if (success) {
           =20
            NSLog(@"we have just successfuly added a tag");
        } else {
           =20
            // check what is the problem.
            NSLog(@"%@", msg);
        }
    }];
}

Remove a Tag<= /strong>

- (void)removeTagWithIdentifier:(N= SString *)tagIdentifier andOperationStatus:(tagStatus)status;
Type Name

Description

NSString identifier

an NSString object which repres= ents a tag name

void(^tagStatus)(BOOL success, NSS= tring *msg) status a type definition block, which not= ifies 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 an=
dOperationStatus:^(BOOL success, NSString *msg) {
       =20
        if (success) {
           =20
            NSLog(@"we have just successfuly added a tag");
        } else {
           =20
            // check what is the problem.
            NSLog(@"%@", msg);
        }
    }];
}

Remove Tags

- (void)removeTagsWithIdentifiers:= (NSArray *)tagIdentifiers andOperationStatus:(tagStatus)status;
Type Name

Description

NSArray tagIdentifiers

an NSArray object, containing o= bjects of Type NSString

void(^tagStatus)(BOOL success, NSS= tring *msg) status a type definition block, which not= ifies 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 =3D @[@"identifier1", @"identifier2"=
, @"....."];
   =20
    [[PushAppsManager sharedInstance] removeTagsWithIdentifiers:identifiers=
 andOperationStatus:^(BOOL success, NSString *msg) {
       =20
        if (success) {
           =20
            NSLog(@"we have just successfuly added a tag");
        } else {
           =20
            // check what is the problem.
            NSLog(@"%@", msg);
        }
    }];
}

 

General Properties

General properties does not indicate Objectiv= e-C style @property, but it is a general term for helper methods provided b= y 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;
Type Name Description
NSString  

an NSString representation of t= he device unique identifier (UDID)

Example:

Device ID

 

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

 

Device Name

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

- (NSString *)getDeviceName
Type Name Description
NSString  

an NSString representation of t= he 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 infor= mation about the SDK version number.

- (NSNumber *)getSDKVersion
Type Name Description
NSString  

an NSString representation of P= ushApps 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
Type Name Description
NSString  

an NSString representation of t= he 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 provi= ded as a convenience method, to quickly remove the application badge number= . 

- (void)clearApplicationBadge
Type Name Description
   

clears the application badge nu= mber, as appears on the home screen

Example:

 

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

 

Are Push Notifications Enabled

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

- (BOOL)arePushNotificationsEnable= d;
Type Name Description
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 r= egistrationForRemoteNotificationFailedWithError:(NSError *)error

{

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

&= nbsp;   if ([[PushAppsManager sharedInstance] arePushNotification= sEnabled]) {

        // if we fail= ed 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 re= gistration. If the developer did not provide any custom ID, method will ret= urn nil.

- (NSString *)getCustomId;
Type Name Description
NSString  

an NSString representation of t= he custom ID which was inputted at registration

------=_Part_601_733685280.1406942951712--