//
JGPushHelp.h
wyb
//
Created by Amoy Yuan Lok on 15/7/29.
Copyright (c) 2015 China Model. All rights reserved.
//
#import <Foundation/Foundation.h>
#import <UIKit/UIKit.h>
@interface Jgpushhelp:nsobject
Called when the app is started
+ (void) Setupwithoptions: (Nsdictionary *) launchoptions;
Called at the Appdelegate registration device
+ (void) Registerdevicetoken: (NSData *) Devicetoken;
After iOS7, only completion, otherwise pass nil
+ (void) Handleremotenotification: (nsdictionary *) UserInfo Completion: (void (^) (uibackgroundfetchresult)) completion ;
Show local notifications at the front
+ (void) Showlocalnotificationatfront: (uilocalnotification *) notification;
@end
//
jgpushhelp.m
wyb
//
Created by Amoy Yuan Lok on 15/7/29.
Copyright (c) 2015 China Model. All rights reserved.
//
#import "JGPushHelp.h"
#import "APService.h"
@implementation Jgpushhelp
+ (void) Setupwithoptions: (Nsdictionary *) launchoptions {
Required
#if __iphone_os_version_max_allowed > __iphone_7_1
You can customize the category after iOS8
if ([[Uidevice currentdevice].systemversion Floatvalue] >= 8.0) {
You can add a custom categories
[Apservice registerforremotenotificationtypes: (Uiusernotificationtypebadge |
Uiusernotificationtypesound |
Uiusernotificationtypealert)
Categories:nil];
} else {
#if __iphone_os_version_max_allowed < __iphone_8_0
iOS8 before the categories must be nil
[Apservice registerforremotenotificationtypes: (Uiremotenotificationtypebadge |
Uiremotenotificationtypesound |
Uiremotenotificationtypealert)
Categories:nil];
#endif
}
#else
The categories must be nil.
[Apservice registerforremotenotificationtypes: (Uiremotenotificationtypebadge |
Uiremotenotificationtypesound |
Uiremotenotificationtypealert)
Categories:nil];
#endif
Required
[Apservice setupwithoption:launchoptions];
Return
}
+ (void) Registerdevicetoken: (NSData *) Devicetoken {
[Apservice Registerdevicetoken:devicetoken];
Return
}
+ (void) Handleremotenotification: (nsdictionary *) UserInfo Completion: (void (^) (uibackgroundfetchresult)) completion {
[Apservice Handleremotenotification:userinfo];
if (completion) {
Completion (Uibackgroundfetchresultnewdata);
}
Return
}
+ (void) Showlocalnotificationatfront: (uilocalnotification *) Notification {
[Apservice showlocalnotificationatfront:notification Identifierkey:nil];
Return
}
@end