浏览代码

在AppDelegate中,初始化极光推送

huangyl3 4 年之前
父节点
当前提交
a79fd117a4

二进制
display-center/display-center.xcworkspace/xcuserdata/huangyulin.xcuserdatad/UserInterfaceState.xcuserstate


+ 25 - 1
display-center/display-center/AppDelegate.mm

@ -21,8 +21,12 @@
21 21
#import <IPUBaiduMap/IPUBaiduMap.h>
22 22
23 23
#import <CoreLocation/CoreLocation.h>
24
#import <IPUPush/IPUPush.h>
24 25
25
@interface AppDelegate () <IPUURLRequestDelegate, CLLocationManagerDelegate>
26
@interface AppDelegate () <IPUURLRequestDelegate, CLLocationManagerDelegate, IPUJPushDelegate>
27
{
28
    IPUJPushPlugin *jPushPlugin;
29
}
26 30
27 31
@property (nonatomic, strong) CLLocationManager *manager;
28 32
@ -33,6 +37,13 @@
33 37
- (id)createViewController {
34 38
    // 初始化根视图
35 39
    ViewController *rootCtrl = [[ViewController alloc] init];
40
    
41
    
42
    {   // 极光推送,远程通知注册
43
        jPushPlugin = [IPUPluginManager getPlugin:@"IPUJPushPlugin" mobileDelegate:rootCtrl];
44
        [jPushPlugin registerAPNSNotification];
45
        jPushPlugin.delegate = self;
46
    }
36 47
        
37 48
    return rootCtrl;
38 49
}
@ -81,8 +92,21 @@
81 92
    [IpuCountReport reportOperWithType:OPERATE_EXIT remark1:nil remark2:nil];
82 93
}
83 94
95
- (void)application:(UIApplication *)application didRegisterForRemoteNotificationsWithDeviceToken:(NSData *)deviceToken {
96
    
97
    {   //极光推送,发送deviceToken至服务器
98
        IPUJPushPlugin *plugin = [IPUPluginManager getPlugin:@"IPUJPushPlugin" mobileDelegate:self.viewController];
99
        [plugin sendDeviceToken:deviceToken];
100
    }
101
    
102
}
103
84 104
- (NSDictionary *)setURLRequestHeader {
85 105
    return nil;
86 106
}
87 107
108
#pragma -mark IPUJPushDelegate
109
- (void)showNotificationWithDic:(NSDictionary *)dic {}
110
111
88 112
@end