(Not get deviceToken yet )极光推送不成
最近做项目发现以前集成好的极光推送突然不好用了。项目提示:Not get deviceToken yet. Maybe: your certificate not configured APNs? or current network is not so good so APNs registration failed? or there is no APNs register code? Please refer to JPush docs.
无奈查不出原因,只有把证书申请,推送证书申请,极光证书提交,代码实现从头到尾给撸撸一遍,无奈还是发现不了问题。
原因是外部appDelegate.m 中调用了
- (void)application:(UIApplication*)application didRegisterForRemoteNotificationsWithDeviceToken:(NSData*)deviceToken {
NSLog(@"deviceToken====%@",deviceToken);
[JPUSHServiceregisterDeviceToken:deviceToken];
}
在环信内部也调用了此方法 导致外部方法未执行 极光未获取到token
- (void)application:(UIApplication*)application didRegisterForRemoteNotificationsWithDeviceToken:(NSData*)deviceToken
{
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT,0), ^{
[[EMClientsharedClient]bindDeviceToken:deviceToken];
});
NSLog(@"deviceToken====%@",deviceToken);
[JPUSHServiceregisterDeviceToken:deviceToken];
}