iOS10,deviceToken变化的问题


#8

旧registrationID是无效的。只是数据上依旧存在

当前,请你重新获取一下registrationID,并检查别名的设置,重设一次,再推送看下


(zongzi) #9

我卸载APP重新刷包,这次可以了,不应该啊,我没怎么改代码啊,这样会不会不稳定,有时候会收不到推送消息啊


(zongzi) #10

这次目标变成3个了,但是只有一个是有效的,我能不能删除无效的ID啊?


#11

iOS是代理的apns通知,所以很多情况是Apple那边决定的,如果你说卸载重装搞定,那么之前的问题就是Apple判断你App的token失效,所以Apple没有推送给你设备。

apple认为token失效了
2、苹果建议程序每次启动的时候从 apns 获取 devicetoken
重新获取一次新的token,测试时,简单的操作就是卸载重装


(zongzi) #12
       - (void)application:(UIApplication *)application didReceiveRemoteNotification:(nonnull NSDictionary *)userInfo fetchCompletionHandler:(nonnull void (^)(UIBackgroundFetchResult))completionHandler {
    NSLog(@"userInfo = = %@ (ios7-)",userInfo);
    if (application.applicationState == UIApplicationStateActive) {
        // 应用程序在前台给一个提示特别消息
        NSLog(@"UIApplicationStateActive === ");
        [JPUSHService handleRemoteNotification:userInfo];
        [self dataManager:userInfo];
        // 需要执行这个方法,选择是否提醒用户,有Badge、Sound、Alert三种类型可以选择设置
        completionHandler(UNNotificationPresentationOptionAlert | UNNotificationPresentationOptionSound);
    } else {
        // 应用程序在后台给一个提示特别消息
        NSLog(@"UIApplicationStateBackground/UIApplicationStateInactive === ");
        [self dataManager:userInfo];
        // 需要执行这个方法,选择是否提醒用户,有Badge、Sound、Alert三种类型可以选择设置
        completionHandler(UIBackgroundFetchResultNewData);
    }
}

还有一个问题这个方法

- (void)application:(UIApplication *)application didReceiveRemoteNotification:(nonnull NSDictionary *)userInfo fetchCompletionHandler:(nonnull void (^)(UIBackgroundFetchResult))completionHandler 

是iOS7以上包括iOS10,都能收到推送消息。

那这个方法

- (void)jpushNotificationCenter:(UNUserNotificationCenter *)center didReceiveNotificationResponse:(UNNotificationResponse *)response withCompletionHandler:(void (^)())completionHandler
- (void)jpushNotificationCenter:(UNUserNotificationCenter *)center willPresentNotification:(UNNotification *)notification withCompletionHandler:(void (^)(NSInteger))completionHandler

iOS10也能收到消息,一个是点击通知栏消息时调用,一个是APP在前台收到消息时调用,我这样理解没问题吧?


#13

是的,具体有个调用顺序等说明请阅读该忒中的图:


(zongzi) #14

好的,基本应该没问题了,谢谢,祝你们极光越做越好:tada:


#15

:yum:感谢,后续有问题可继续在社区提出。


(zongzi) #17

还有就是推送失败的概率有点高


(zongzi) #18


推送配置、别名都没问题,怎么收不到推送呢?


(zongzi) #19

大神,又有点问题问一下,设置别名的时候,会不会覆盖后台之前保存的别名,就是这种情况啊:我们是使用用户ID来当别名,用同一个账号登录不同手机,会设置2次别名,但是推送只会推到第一次设置别名的手机。按理说,应该重新设置别名会覆盖,推送到最新设置别名的手机上。这是怎么回事?


#20

1、一个设备只能设置一个别名,在一个设备上多次设置别名,最后一个有效
2、在不同设备上设备别名不会影响之前的设备
3、别名要设置成功,且成功的时间点在推送之前。


(zongzi) #21

我们测试同一个账号(同别名)在不同设备设置别名且都成功,只有第一次设置别名的设备会受到推送,其他设备没有收到。


#22

请提供你在其他设备设置别名成功的客户端日志,完整的带上时间戳
并提供你推送的消息的msgid和你这个设备的registrationID


(zongzi) #23

好的,请稍等


(zongzi) #24

2017-05-04 09:58:42.672748 WeRentCar[4446:1760889]  | JIGUANG | E - [JIGUANGAddressController] not receive sis result just now
2017-05-04 09:58:44.826834 WeRentCar[4446:1760779]  | JIGUANG | E - [JIGUANGAddressController] not receive sis result just now
2017-05-04 10:00:00.946557 WeRentCar[4446:1761387] [] nw_socket_write_close shutdown(30, SHUT_WR): [57] Socket is not connected
2017-05-04 10:00:00.946606 WeRentCar[4446:1761387] [] nw_endpoint_flow_service_writes [7.1 123.56.76.78:443 ready socket-flow (satisfied)] Write request has 0 frame count, 0 byte count
2017-05-04 10:00:00.948580 WeRentCar[4446:1761387] [] nw_socket_write_close shutdown(35, SHUT_WR): [57] Socket is not connected
2017-05-04 10:00:00.948622 WeRentCar[4446:1761387] [] nw_endpoint_flow_service_writes [9.1 123.56.76.78:443 ready socket-flow (satisfied)] Write request has 0 frame count, 0 byte count
2017-05-04 10:00:00.948765 WeRentCar[4446:1761387] [] nw_socket_write_close shutdown(34, SHUT_WR): [57] Socket is not connected
2017-05-04 10:00:00.948785 WeRentCar[4446:1761387] [] nw_endpoint_flow_service_writes [8.1 123.56.76.78:443 ready socket-flow (satisfied)] Write request has 0 frame count, 0 byte count
2017-05-04 10:00:00.948901 WeRentCar[4446:1761387] [] nw_socket_write_close shutdown(36, SHUT_WR): [57] Socket is not connected
2017-05-04 10:00:00.956891 WeRentCar[4446:1761385] [] __tcp_connection_write_eof_block_invoke Write close callback received error: [89] Operation canceled
2017-05-04 10:00:00.957025 WeRentCar[4446:1761386] [] __tcp_connection_write_eof_block_invoke Write close callback received error: [89] Operation canceled
2017-05-04 10:00:00.957077 WeRentCar[4446:1761384] [] __tcp_connection_write_eof_block_invoke Write close callback received error: [89] Operation canceled
2017-05-04 10:00:00.957109 WeRentCar[4446:1761387] [] nw_endpoint_flow_service_writes [14.1 123.56.76.78:443 ready socket-flow (satisfied)] Write request has 0 frame count, 0 byte count
2017-05-04 10:00:00.957351 WeRentCar[4446:1761387] [] nw_socket_write_close shutdown(44, SHUT_WR): [57] Socket is not connected
2017-05-04 10:00:00.957377 WeRentCar[4446:1761387] [] nw_endpoint_flow_service_writes [13.1 123.56.76.78:443 ready socket-flow (satisfied)] Write request has 0 frame count, 0 byte count
2017-05-04 10:00:00.958882 WeRentCar[4446:1761387] [] nw_socket_get_input_frames recvmsg(fd 30, 1024 bytes): [54] Connection reset by peer
2017-05-04 10:00:00.964743 WeRentCar[4446:1761384] [] __tcp_connection_write_eof_block_invoke Write close callback received error: [89] Operation canceled
2017-05-04 10:00:00.964821 WeRentCar[4446:1761386] [] __tcp_connection_write_eof_block_invoke Write close callback received error: [89] Operation canceled
2017-05-04 10:00:00.965000 WeRentCar[4446:1761387] [] nw_socket_get_input_frames recvmsg(fd 35, 1024 bytes): [54] Connection reset by peer
2017-05-04 10:00:00.965051 WeRentCar[4446:1761387] [] nw_socket_get_input_frames recvmsg(fd 34, 1024 bytes): [54] Connection reset by peer
2017-05-04 10:00:00.965092 WeRentCar[4446:1761387] [] nw_socket_get_input_frames recvmsg(fd 36, 1024 bytes): [54] Connection reset by peer
2017-05-04 10:00:00.965131 WeRentCar[4446:1761387] [] nw_socket_get_input_frames recvmsg(fd 44, 1024 bytes): [54] Connection reset by peer
2017-05-04 10:00:00.967247 WeRentCar[4446:1761387] [] nw_socket_write_close shutdown(50, SHUT_WR): [57] Socket is not connected
2017-05-04 10:00:00.971665 WeRentCar[4446:1761387] [] nw_endpoint_flow_service_writes [15.1 123.56.76.78:443 ready socket-flow (satisfied)] Write request has 0 frame count, 0 byte count
2017-05-04 10:00:00.972513 WeRentCar[4446:1761384] [] __tcp_connection_write_eof_block_invoke Write close callback received error: [89] Operation canceled
2017-05-04 10:00:01.041807 WeRentCar[4446:1761387]  | JIGUANG | E - [JIGUANGAddressController] not receive sis result just now
2017-05-04 10:00:03.109183 WeRentCar[4446:1761384]  | JIGUANG | E - [JIGUANGAddressController] not receive sis result just now
2017-05-04 10:00:03.111710 WeRentCar[4446:1761384] dnssd_clientstub write_all(14) DEFUNCT
2017-05-04 10:00:03.111767 WeRentCar[4446:1761384] dnssd_clientstub deliver_request ERROR: write_all(14, 58 bytes) failed
2017-05-04 10:00:03.112370 WeRentCar[4446:1761384] dnssd_clientstub write_all(14) DEFUNCT
2017-05-04 10:00:03.441109 WeRentCar[4446:1761384]  | JIGUANG | I - [JIGUANGSessionController] connecting with coreAddr 121.46.20.42,port 7006
2017-05-04 10:00:03.706506 WeRentCar[4446:1761384]  | JIGUANG | I - [JIGUANGLogin] 
----- login result -----
uid:9288730922 
registrationID:1114a89792992e9222b
2017-05-04 10:00:07.634285 WeRentCar[4446:1761385] [] nw_endpoint_handler_add_write_request [6.1 110.75.231.90:443 failed socket-flow (satisfied)] cannot accept write requests
2017-05-04 10:00:07.636447 WeRentCar[4446:1761387] [] __tcp_connection_write_eof_block_invoke Write close callback received error: [22] Invalid argument

2017-05-04 10:13:07.332714 WeRentCar[4446:1760593] 设置别名成功,iAlias = 10002dxwb7x7

打印了一些日志,但是看最后这个返回别名也成功了,我发送了一条消息,目标是0,不知怎么回事?


#25

你设置的别名跟你推送的别名是一样的吗??明显不是啊


(zongzi) #26

不好意思,混乱了,之前使用账号,后来忘了:sweat:


(zongzi) #27
2017-05-04 10:00:07.634285 WeRentCar[4446:1761385] [] nw_endpoint_handler_add_write_request [6.1 110.75.231.90:443 failed socket-flow (satisfied)] cannot accept write requests
2017-05-04 10:00:07.636447 WeRentCar[4446:1761387] [] __tcp_connection_write_eof_block_invoke Write close callback received error: [22] Invalid argument
2017-05-04 10:11:25.100566 WeRentCar[4446:1764307] [] nw_socket_get_input_frames recvmsg(fd 21, 1024 bytes): [57] Socket is not connected
2017-05-04 10:11:25.101022 WeRentCar[4446:1764307] [] nw_socket_get_input_frames recvmsg(fd 30, 1024 bytes): [57] Socket is not connected
2017-05-04 10:11:25.101515 WeRentCar[4446:1764307] [] nw_socket_get_input_frames recvmsg(fd 29, 1024 bytes): [57] Socket is not connected
2017-05-04 10:11:25.101881 WeRentCar[4446:1764307] [] nw_socket_get_input_frames recvmsg(fd 17, 1024 bytes): [57] Socket is not connected
2017-05-04 10:11:25.110992 WeRentCar[4446:1764307] [] nw_endpoint_handler_add_write_request [21.1 140.205.250.3:443 failed socket-flow (satisfied)] cannot accept write requests
2017-05-04 10:11:25.116920 WeRentCar[4446:1761474] [] nw_connection_write_close 20 Connection is not ready, sending error callback
2017-05-04 10:11:25.120066 WeRentCar[4446:1761474] [] __tcp_connection_write_eof_block_invoke Write close callback received error: [57] Socket is not connected
2017-05-04 10:11:25.121313 WeRentCar[4446:1761474] [] nw_connection_write_close 17 Connection is not ready, sending error callback
2017-05-04 10:11:25.121436 WeRentCar[4446:1761474] [] __tcp_connection_write_eof_block_invoke Write close callback received error: [57] Socket is not connected
2017-05-04 10:11:25.122809 WeRentCar[4446:1764323] [] nw_connection_write_close 18 Connection is not ready, sending error callback
2017-05-04 10:11:25.124474 WeRentCar[4446:1764307] [] __tcp_connection_write_eof_block_invoke Write close callback received error: [57] Socket is not connected
2017-05-04 10:11:25.126195 WeRentCar[4446:1764324] [] nw_connection_write_close 19 Connection is not ready, sending error callback
2017-05-04 10:11:25.127111 WeRentCar[4446:1764324] [] __tcp_connection_write_eof_block_invoke Write close callback received error: [57] Socket is not connected
2017-05-04 10:11:25.128300 WeRentCar[4446:1764326] [] __tcp_connection_write_eof_block_invoke Write close callback received error: [22] Invalid argument
2017-05-04 10:11:25.172957 WeRentCar[4446:1764326]  | JIGUANG | E - [JIGUANGUdpSocket] udp read error occured: errocode 57
2017-05-04 10:11:25.182913 WeRentCar[4446:1764326]  | JIGUANG | E - [JIGUANGSessionController] did not receive udp data with error 57
2017-05-04 10:11:25.194467 WeRentCar[4446:1764326]  | JIGUANG | W - [JIGUANGSessionController] 连接被关闭

但是会受到这些信息,是什么意思啊?


#28

网络连接、失败重连的日志打印