1,极光推送别名注册方法(也可以用tag进行注册)。。。。
【
// 这是极光提供的方法,USER_INFO.userID是用户的id,你可以根据账号或者其他来设置,只要保证唯一便可
[JPUSHService setAlias:userMobile completion:^(NSInteger iResCode, NSString *iAlias, NSInteger seq) {
// NSLog(@"iAlias ==%@ iResCode = %ld seq = %d",iAlias,iResCode,seq);
} seq:1];
】
2,从极光获取设备的唯一标示//可以上传到自己的服务器进行设备唯一标示判断
[JPUSHService registrationIDCompletionHandler:^(int resCode, NSString *registrationID) {
if (resCode==0) {
NSLog(@"registrationID获取成功:%@",registrationID);
}else{
NSLog(@"registrationID获取失败,code:%d",resCode);
}
}];
3,注销在极光推送的注册方法
[JPUSHService deleteAlias:^(NSInteger iResCode, NSString *iAlias, NSInteger seq) {
} seq:1];
4,实现极光推送内部通知(没有消息提示推送的样式)
//极光推送内部通知
NSNotificationCenter *defaultCenter = [NSNotificationCenter defaultCenter];
[defaultCenter addObserver:self selector:@selector(networkDidReceiveMessage:) name:kJPFNetworkDidReceiveMessageNotification object:nil];
#pragma mark -- 极光推送内容通知处理
- (void)networkDidReceiveMessage:(NSNotification *)notification {}
5,极光推送角标问题
- (void)applicationDidEnterBackground:(UIApplication *)application {
[[UIApplication sharedApplication] setApplicationIconBadgeNumber:0];
[JPUSHService setBadge:0];//设置JPush服务器中存储的badge值
}
- (void)applicationWillEnterForeground:(UIApplication *)application {
[application setApplicationIconBadgeNumber:0];
[JPUSHService resetBadge];//清空JPush服务器中存储的badge值
[[UNUserNotificationCenter alloc] removeAllPendingNotificationRequests];
}
=====以上极光官网都有相应的文档说明及api使用(可进官网查看)====
网友评论