ios打包后,无法接收推送的消息

ios
标签: #<Tag:0x00007fb845eade40>

(bruce.wu) #1

环境: xcode 10.1
我们的推送服务使用的极光推送,由于收不到推送消息已经按照极光的设置文档(http://docs.jiguang.cn/jpush/client/iOS/ios_cer_guide/),重新设置几遍证书了
设置好证书后打包上传APP,iOS手机端使用testflight安装应用,就是收不到推送消息
网上各种google依然没有解决这个问题

将手机连接到mac使用控制台工具,监控到如下信息:
| JIGUANG | W - [JIGUANGClientController] 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.
通过修改代码打印出截取到的错误如下:
Error Domain=NSCocoaErrorDomain Code=3000 “未找到应用程序的“aps-environment”的授权字符串” UserInfo={NSLocalizedDescription=未找到应用程序的“aps-environment”的授权字符串}

请懂的朋友帮忙看看是哪里的问题,提前谢谢大家


#2

(bruce.wu) #3

我用的xcode版本是10.1,不是xode8
没有那篇文章上面说的那个"code signing entitlements"选项
但是有 “code signing identity”,在这个选项下我看了,设置的是没有问题的


#4

你之前报的是取不到 token,后来改了什么又爆了下面的错?

修改回去后,看完整的客户端日志,并给我提供设备的 registrationID 与你推送的消息的MessageID 值


(bruce.wu) #5
- (void)application:(UIApplication *)application didFailToRegisterForRemoteNotificationsWithError:(NSError *)error{
  NSLog(@"didFailToRegisterForRemoteNotificationsWithError:%@",error);
}

增加了打印错误日志后显示的后来的报错


(Ethan) #6

1、获取不到deviceToken和报错是同时存在的,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. 是极光推送的日志输出的结果,报错信息是在didFailToRegisterForRemoteNotificationsWithError 里打印的结果。

2、日志如下:

默认	11:10:32.248545 +0800	RCC工程招采	 | JIGUANG | D - [JIGUANGService] Action - JPUSH begin Setup with appkey: channel:channel name isProduction:TRUE advertisingIdentifier:
默认	11:10:32.294727 +0800	RCC工程招采	 | JIGUANG | I - [JIGUANGService] 
--------------------------- JPush Log ----------------------------
--------------------JPush SDK Version:3.0.7--build:45----------
--------------------JCore Lib Version:1.2.5--build:64----------
-----------------AppKey:----------------
----------------------------------------------------------------
默认	11:10:32.302216 +0800	RCC工程招采	 | JIGUANG | I - [JIGUANGClientController] Action - jpush setup
默认	11:10:32.306213 +0800	RCC工程招采	 | JIGUANG | I - [JIGUANGClientController] Action - setup
默认	11:10:32.307094 +0800	RCC工程招采	 | JIGUANG | E - [JIGUANGClientController] load aps evi error, no em provision url
默认	11:10:32.319579 +0800	RCC工程招采	 | JIGUANG | W - [JIGUANGService] 请将JPush的初始化方法,添加到[UIApplication application: didFinishLaunchingWithOptions:]方法中,否则JPush将不能准确的统计到通知的点击数量。参考文档:https://docs.jiguang.cn/jpush/client/iOS/ios_guide_new/#_6
默认	11:10:32.471017 +0800	RCC工程招采	 | JIGUANG | D - [JIGUANGNetworkController] Action - trySetupSession
默认	11:10:32.471108 +0800	RCC工程招采	 | JIGUANG | D - [JIGUANGHttpSessionController] Action - setupSession
默认	11:10:32.471189 +0800	RCC工程招采	 | JIGUANG | D - [JIGUANGNetworkController] userDefaut verified: 1
默认	11:10:32.471374 +0800	RCC工程招采	 | JIGUANG | D - [JIGUANGUtilities] JCOREPostNotificationWithUserInfo name: kJPFNetworkIsConnectingNotification (null)
默认	11:10:32.471466 +0800	RCC工程招采	 | JIGUANG | D - [JIGUANGSessionController] Action - connect
默认	11:10:32.471547 +0800	RCC工程招采	 | JIGUANG | D - [JIGUANGSessionController] Action - isSisOnProtect
默认	11:10:32.471717 +0800	RCC工程招采	 | JIGUANG | D - [JIGUANGSessionController] sis is not on protect
默认	11:10:32.471829 +0800	RCC工程招采	 | JIGUANG | D - [JIGUANGSessionController] Action - reset sis cache
默认	11:10:32.471923 +0800	RCC工程招采	 | JIGUANG | D - [JIGUANGAddressController] 开始Sis解析
默认	11:10:32.472053 +0800	RCC工程招采	 | JIGUANG | D - [JIGUANGAddressController] Action - sendSisRequest
默认	11:10:32.476204 +0800	RCC工程招采	 | JIGUANG | D - [JIGUANGAddressController] get address :124.202.138.11 from host : s.jpush.cn
默认	11:10:32.476292 +0800	RCC工程招采	 | JIGUANG | D - [JIGUANGTcpAddressSis] Action - sendSisRequest:toDefaultPort:toCustomPort
默认	11:10:32.480206 +0800	RCC工程招采	 | JIGUANG | D - [JIGUANGUdpSocket] close udp socket,info:
默认	11:10:32.488210 +0800	RCC工程招采	 | JIGUANG | D - [JIGUANGUdpSocket] send udp data
默认	11:10:32.488300 +0800	RCC工程招采	 | JIGUANG | D - [JIGUANGUdpSocket] send udp data succeed
默认	11:10:32.488388 +0800	RCC工程招采	 | JIGUANG | D - [JIGUANGUdpSocket] udp socket begin send behavior
默认	11:10:32.515371 +0800	RCC工程招采	 | JIGUANG | D - [JIGUANGTcpAddressSis] Action - parse
默认	11:10:32.554028 +0800	RCC工程招采	 | JIGUANG | D - [JIGUANGTcpAddressSis] Action - parse ips address
默认	11:10:32.602891 +0800	RCC工程招采	 | JIGUANG | D - [JIGUANGTcpAddressSis] Action - parseOptionAddress
默认	11:10:32.689893 +0800	RCC工程招采	 | JIGUANG | D - [JIGUANGUdpSocket] close udp socket,info:
默认	11:10:32.690018 +0800	RCC工程招采	 | JIGUANG | D - [JIGUANGSessionController] current network, ipv4
默认	11:10:32.708055 +0800	RCC工程招采	 | JIGUANG | D - [JIGUANGSessionController] Action - connectTcp
默认	11:10:32.711579 +0800	RCC工程招采	 | JIGUANG | D - [JIGUANGSessionController] Action - connectTcpAddress:
默认	11:10:32.746419 +0800	RCC工程招采	 | JIGUANG | D - [JIGUANGSessionController] connectTcp:124.202.138.23:7003
默认	11:10:32.746694 +0800	RCC工程招采	 | JIGUANG | I - [JIGUANGSessionController] connecting with coreAddr 124.202.138.23,port 7003
默认	11:10:32.846815 +0800	RCC工程招采	 | JIGUANG | D - [JIGUANGTcpSocket] 连接主机成功
默认	11:10:32.846974 +0800	RCC工程招采	 | JIGUANG | D - [JIGUANGTcpAddressSis] Action - sisReport:port
默认	11:10:32.848677 +0800	RCC工程招采	 | JIGUANG | D - [JIGUANGUtilities] JCOREPostNotificationWithUserInfo name: kJPUSHNetworkDidSetupNotification (null)
默认	11:10:32.955842 +0800	RCC工程招采	 | JIGUANG | D - [JIGUANGSessionController] Action - doSendTcpRequest
默认	11:10:33.032900 +0800	RCC工程招采	 | JIGUANG | I - [JIGUANGLogin] 
----- login result -----
uid:20238851375 
registrationID:1114a89792f0d1bb62e 
idc:1
默认	11:10:33.033038 +0800	RCC工程招采	 | JIGUANG | D - [JIGUANGTcpSocket] Got tcp command
默认	11:10:33.033199 +0800	RCC工程招采	 | JIGUANG | D - [JIGUANGSessionController] Action - onAckOrRespReceived:
默认	11:10:33.033318 +0800	RCC工程招采	 | JIGUANG | D - [JIGUANGSessionController] Event - onLoginRespond
默认	11:10:33.035612 +0800	RCC工程招采	 | JIGUANG | D - [JIGUANGUtilities] JCOREPostNotificationWithUserInfo name: kJPUSHNetworkDidLoginNotification (null)
默认	11:10:34.368965 +0800	RCC工程招采	 | JIGUANG | D - [JIGUANGService] Action - registrationID
默认	11:10:34.976292 +0800	RCC工程招采	 | JIGUANG | W - [JIGUANGClientController] 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.
默认	11:10:36.974916 +0800	RCC工程招采	 | JIGUANG | W - [JIGUANGClientController] 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.
默认	11:10:38.974384 +0800	RCC工程招采	 | JIGUANG | W - [JIGUANGClientController] 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.
默认	11:10:40.976778 +0800	RCC工程招采	 | JIGUANG | W - [JIGUANGClientController] 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.
默认	11:10:42.975098 +0800	RCC工程招采	 | JIGUANG | W - [JIGUANGClientController] 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.

#7

从这个日志看出是极光的 registrationID 取到了但是 token 没取到

根据这个检查一下


(bruce.wu) #8

在项目目录中找到这个文件:Entitle-release.plist (不要在xcode中找,找不到,访达中去找)
看看有没有 aps-environment 字段,没有补上,内容如下
可以从 demo 中找到 Entitlements.plist 拖入你自己的工程。
<plist version="1.0"> <dict> <key>aps-environment</key> <string>production</string> </dict> </plist>