php ios 极光推送,iOS | 集成极光推送遇到的坑

---------------->Bug_001

iOS 10 新增了大量关于通知的新特性,详情参照极光官方的Blog。

iOS 10新增了Service Extension

错误日志如下:

Undefined symbols for architecture arm64:

"_dns_parse_resource_record", referenced from:

-[JPushExtensionSRVResolver processRecord:length:] in jpush-extension-ios-1.1.1.a(JPushExtensionSRVResolver.o)

"_dns_free_resource_record", referenced from:

-[JPushExtensionSRVResolver processRecord:length:] in jpush-extension-ios-1.1.1.a(JPushExtensionSRVResolver.o)

ld: symbol(s) not found for architecture arm64

clang: error: linker command failed with exit code 1 (use -v to see invocation)

58264ba049b6

bug001.png

解决办法就是: 添加相关的依赖库 libresolv.tbd 就可以了

58264ba049b6

bug003.png

---------------->Bug_002

极光错误提示:

| JIGUANG | W - [JIGUANGDeviceTokenController] 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.

| JIGUANG | W - [JIGUANGDeviceTokenController] Not get deviceToken yet. After successful login, a custom message can be sent, but the APNs notification cannot. Until the deviceToken is obtained and reported successfully, the APNs notification can be used normally.

58264ba049b6

bug005.png

这样的错误提示,是因为在

- (void)application:(UIApplication *)application didRegisterForRemoteNotificationsWithDeviceToken:(NSData *)deviceToken

这个方法里,没有执行极光推送的方法将deviceToken传给SDK

// 将得到的deviceToken传给SDK

- (void)application:(UIApplication *)application didRegisterForRemoteNotificationsWithDeviceToken:(NSData *)deviceToken

{

dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{

[[EMClient sharedClient] bindDeviceToken:deviceToken];

});

[JPUSHService registerDeviceToken:deviceToken];

}

但是我明明在 AppDelegate.m 里面实现了上面的方法,并写入了极光推送的注册DeviceToken方法,但是发现就是不走上面的方法,后来看到了下面这篇博客,原来有人跟我遇到了同样的问题,就是在使用环信IM的时候,同时也集成了极光推送,在使用环信IM的时候,它在AppDelegate的分类中重写了方法didRegisterForRemoteNotificationsWithDeviceToken: ,覆盖了我在AppDelegate中写的方法,所以导致我在方法里写的极光推送注册deviceToken的方法不执行。

原来 环信IM 为AppDelegate 添加了一个 类目:AppDelegate+EaseMob.h,重写了

(void)application:(UIApplication *)application didRegisterForRemoteNotificationsWithDeviceToken:(NSData *)deviceToken;

,所以之前的app delete 里面写了

[JPUSHService registerDeviceToken:deviceToken];

没有调用,所以收不到推送。

找了半天,才发现。

解决办法:就是将极光推送的deviceToken注册方法放到 AppDelegate+EaseMob.h 文件中的 didRegisterForRemoteNotificationsWithDeviceToken: 方法里。

希望可以帮到一部分人。

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值