首次打开App无法登录极光,添加了观察者后不走该方法

ios
标签: #<Tag:0x00007fb845ef8440>

(Ace") #1

第一次打开的时候无法登录进去,设置是按照demo设置的,配置文件也都齐全,
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(kJPushnetworkDidLogin:) name:kJPFNetworkDidLoginNotification object:nil];
使用了观察者也不走方法, 在后台发送推送是可以收到消息的,但是自定义消息就不行了,sdk是最新的。


(Ace") #2

第二次打开就可以收到了,感觉就是登陆不成功的问题,但是一直不走监听方法,程序里也集成了环信,不过把环信代码注释掉的话也没有用


#3

看一下你的客户端日志信息,如果是报找不到 token,根据这个排查

获取token注册 APNS的只需要一处即可


(Ace") #5

token倒是也不为空,环信那边我也专门问过他们现在最新的SDK是没有去重写过Appdelegate的方法,我的registrationID是可以获取到的,但是也会执行连续五次报错的操作,pushNotifications已经打开,包括bundleID这些我也都排查过了,内网的话倒不至于,因为是公司同事用正式网玩出来的bug。。devicetoken只获取了一次,就是好奇,第一次进来不行第二次就行了,日志打印的也不能完全看明白,不过有一个怀疑点
| JIGUANG | D - [JIGUANGUtilities] JCOREPostNotificationWithUserInfo name: kJPUSHNetworkDidRegisterNotification {
RegistrationID = 121c83f7600cddb4eb5;
StatusCode = 0;
}
这是控制台打印出来的
| JIGUANG | I - [JIGUANGLogin]
----- login result -----
uid:15807152386
registrationID:121c83f7600cddb4eb5
idc:1

这三条信息一直在出
| JIGUANG | D - [JIGUANGSessionController] Action - doSendTcpRequest
| JIGUANG | D - [JIGUANGTcpSocket] Got tcp command
| JIGUANG | D - [JIGUANGSessionController] Action - onAckOrRespReceived:


#6

将你完整的日志提供一下吧,从第一次打开初始化到第二次打开,得到的所有日志

你使用环信的时候没有包含 初始化 APNs 的相关代码吗


(Ace") #7

是的,我没有使用环信的推送相关,我现在是所有的状态监听都不触发
第一次打开:

| JIGUANG | I - [JIGUANGService] 
--------------------------- JPush Log ----------------------------
--------------------JPush SDK Version:3.1.1--build:66----------
--------------------JCore Lib Version:1.2.5--build:64----------
-----------------AppKey:bb72108c6a918ae0fa0a7e5f----------------
----------------------------------------------------------------
| JIGUANG | I - [JIGUANGClientController] Action - jpush setup
| JIGUANG | I - [JIGUANGClientController] Action - setup
| JIGUANG | D - [JIGUANGUserDefaultsController] read from old keychain data
| JIGUANG | D - [JIGUANGUserDefaultsController] no old content, set new appKey
| JIGUANG | D - [JIGUANGPageFlow] trySetupSession
| JIGUANG | D - [JIGUANGPageFlow] setupSession
| JIGUANG | D - [JIGUANGUtilities] wifi 信息:{
    itime = 1542700561;
    "mac_address" = "d6:6d:6d:17:eb:ac";
    ssid = "LINYY 0792";
}
| JIGUANG | D - [JIGUANGUtilities] WWAN 信息:{
    generation = wifi;
    itime = 1542700561;
    "mobile_country_code" = "-1";
    "mobile_network_code" = "-1";
    "radio_type" = UNKNOWN;
}
| JIGUANG | D - [JIGUANGNetworkController] Action - trySetupSession
| JIGUANG | D - [JIGUANGHttpSessionController] Action - setupSession
| JIGUANG | D - [JIGUANGNetworkController] userDefaut verified: 1
| JIGUANG | D - [JIGUANGUtilities] JCOREPostNotificationWithUserInfo name: kJPFNetworkIsConnectingNotification (null)
| JIGUANG | D - [JIGUANGSessionController] Action - connect
| JIGUANG | D - [JIGUANGSessionController] Action - isSisOnProtect
| JIGUANG | D - [JIGUANGSessionController] sis is not on protect
| JIGUANG | D - [JIGUANGSessionController] Action - reset sis cache
| JIGUANG | D - [JIGUANGAddressController] 开始Sis解析
| JIGUANG | D - [JIGUANGAddressController] Action - sendSisRequest
| JIGUANG | D - [JIGUANGAddressController] get address :124.202.138.30 from host : s.jpush.cn
| JIGUANG | D - [JIGUANGTcpAddressSis] Action - sendSisRequest:toDefaultPort:toCustomPort
| JIGUANG | D - [JIGUANGUdpSocket] close udp socket,info:
| JIGUANG | D - [JIGUANGUdpSocket] send udp data
| JIGUANG | D - [JIGUANGUdpSocket] send udp data succeed
| JIGUANG | D - [JIGUANGUdpSocket] udp socket begin send behavior
| JIGUANG | D - [JIGUANGService] Action - registerDeviceToken: <0a404fb4 d9de7354 61214118 e05ebe11 1adc915c 09b8291c e49ce92e 8b9e72cb>
| JIGUANG | D - [JIGUANGUserDefaultsController] Action - setCurrentDeviceToken - 0a404fb4d9de735461214118e05ebe111adc915c09b8291ce49ce92e8b9e72cb
| JIGUANG | D - [JIGUANGService] Action - registerDeviceToken: <0a404fb4 d9de7354 61214118 e05ebe11 1adc915c 09b8291c e49ce92e 8b9e72cb>
| JIGUANG | D - [JIGUANGDeviceTokenController] the same device token, not be updated again
| JIGUANG | D - [JIGUANGAddressController] get address :43.247.88.107 from host : sis.jpush.io
| JIGUANG | D - [JIGUANGTcpAddressSis] Action - sendSisRequest:toDefaultPort:toCustomPort
| JIGUANG | D - [JIGUANGUdpSocket] close udp socket,info:
| JIGUANG | D - [JIGUANGUdpSocket] send udp data
| JIGUANG | D - [JIGUANGUdpSocket] send udp data succeed
| JIGUANG | D - [JIGUANGUdpSocket] udp socket begin send behavior
| JIGUANG | D - [JIGUANGTcpAddressSis] Action - parse
| JIGUANG | D - [JIGUANGTcpAddressSis] Action - parse ips address
| JIGUANG | D - [JIGUANGTcpAddressSis] Action - parseOptionAddress
| JIGUANG | D - [JIGUANGUdpSocket] close udp socket,info:
| JIGUANG | D - [JIGUANGSessionController] current network, ipv4
| JIGUANG | D - [JIGUANGSessionController] Action - connectTcp
| JIGUANG | D - [JIGUANGSessionController] Action - connectTcpAddress:
| JIGUANG | D - [JIGUANGSessionController] connectTcp:103.230.236.29:7008
| JIGUANG | I - [JIGUANGSessionController] connecting with coreAddr 103.230.236.29,port 7008
| JIGUANG | D - [JIGUANGTcpSocket] 连接主机成功
| JIGUANG | D - [JIGUANGTcpAddressSis] Action - sisReport:port
| JIGUANG | D - [JIGUANGUdpSocket] send udp data
| JIGUANG | D - [JIGUANGUdpSocket] send udp data succeed
| JIGUANG | D - [JIGUANGUtilities] JCOREPostNotificationWithUserInfo name: kJPUSHNetworkDidSetupNotification (null)
| JIGUANG | D - [JIGUANGSessionController] Action - doSendTcpRequest
| JIGUANG | I - [JIGUANGRegistration] 
----- register info -----
Appkey: bb72108c6a918ae0fa0a7e5f
token:0a404fb4d9de735461214118e05ebe111adc915c09b8291ce49ce92e8b9e72cb  
 advertisingIdentifier:
| JIGUANG | D - [JIGUANGRegistration] Register info - strKey:iPhone0c0a0e080f030d0701$$ $$hf.framework.mall.doctor$$bb72108c6a918ae0fa0a7e5f clientInfo:11.4.1$$iPhone7,1$$ $$ $$AppStore$$3.1.1| | |1.2.5| | , deviceToken:0a404fb4d9de735461214118e05ebe111adc915c09b8291ce49ce92e8b9e72cb, aps-Environment:1, configApsEnvironment:1 advertisingIdentifier:
| JIGUANG | D - [JIGUANGUdpSocket] udp socket begin send behavior
| JIGUANG | D - [JIGUANGTcpAddressSis] Action - parse
| JIGUANG | I - [JIGUANGRegistration] 
----- register result -----
uid: 15307545331
registrationID:101d8559096cc7bbde4
| JIGUANG | D - [JIGUANGTcpSocket] Got tcp command
| JIGUANG | D - [JIGUANGSessionController] Action - onAckOrRespReceived:
| JIGUANG | D - [JIGUANGSessionController] Action - onRegisterRespond:
| JIGUANG | D - [JIGUANGUtilities] JCOREPostNotificationWithUserInfo name: kJPUSHNetworkDidRegisterNotification {
    RegistrationID = 101d8559096cc7bbde4;
    StatusCode = 0;
}
| JIGUANG | D - [JIGUANGSessionController] Action - doSendTcpRequest
| JIGUANG | I - [JIGUANGLogin] 
----- login result -----
uid:15307545331 
registrationID:101d8559096cc7bbde4 
idc:1
| JIGUANG | D - [JIGUANGTcpSocket] Got tcp command
| JIGUANG | D - [JIGUANGSessionController] Action - onAckOrRespReceived:
| JIGUANG | D - [JIGUANGSessionController] Event - onLoginRespond
| JIGUANG | D - [JIGUANGUtilities] wifi 信息:{
    itime = 1542700569;
    "mac_address" = "d6:6d:6d:17:eb:ac";
    ssid = "LINYY 0792";
}
| JIGUANG | D - [JIGUANGUtilities] WWAN 信息:{
    generation = wifi;
    itime = 1542700569;
    "mobile_country_code" = "-1";
    "mobile_network_code" = "-1";
    "radio_type" = UNKNOWN;
}
| JIGUANG | D - [JIGUANGUtilities] JCOREPostNotificationWithUserInfo name: kJPUSHNetworkDidLoginNotification (null)
| JIGUANG | D - [JIGUANGSessionController] Action - doSendTcpRequest
| JIGUANG | I - [JIGUANGDeviceTokenReport] try to upload device token:0a404fb4d9de735461214118e05ebe111adc915c09b8291ce49ce92e8b9e72cb
| JIGUANG | D - [JIGUANGTcpSocket] Got tcp command
| JIGUANG | D - [JIGUANGSessionController] Action - onAckOrRespReceived:
| JIGUANG | D - [JIGUANGDeviceTokenReport] upload device token success, current token is : 0a404fb4d9de735461214118e05ebe111adc915c09b8291ce49ce92e8b9e72cb
| JIGUANG | D - [JIGUANGReport] send report:(
        {
        itime = 1542700569;
        level = 100;
        status = 2;
        type = battery;
    }
) log succed
| JIGUANG | D - [JIGUANGReport] send report:(
        {
        date = "2018-11-20";
        itime = 1542700561;
        "session_id" = 90074b988e8b23b18fe703c5a23586ca;
        time = "15:56:01";
        timezone = "+8";
        type = "active_launch";
    }
) log succed
| JIGUANG | D - [JIGUANGReport] send report:(
        {
        alert = 2;
        "alert_style" = 1;
        "auth_status" = 2;
        badge = 2;
        "car_play" = 0;
        "critical_alert" = 0;
        "device_id" = 6d65a87837b5a37a15a445d9aeb8b146;
        itime = 1542700569;
        "lock_screen" = 2;
        notification = 2;
        "provides_app_notification" = 0;
        sound = 2;
        "sys_ver" = "11.4.1";
        "trigger_scene" = 2;
        type = "ios_notification_state";
    }
) log succed
| JIGUANG | D - [JIGUANGReport] send report:(
        {
        data =         (
                        {
                cell =                 (
                                        {
                        generation = wifi;
                        itime = 1542700569;
                        "mobile_country_code" = "-1";
                        "mobile_network_code" = "-1";
                        "radio_type" = UNKNOWN;
                    }
                );
                itime = 1542700569;
                wifi =                 (
                                        {
                        itime = 1542700569;
                        "mac_address" = "d6:6d:6d:17:eb:ac";
                        ssid = "LINYY 0792";
                    }
                );
            }
        );
        itime = 1542700561;
        "network_type" = "WIFI,";
        type = "loc_info";
    }
) log succed
| JIGUANG | D - [JIGUANGReport] send report:(
        {
        itime = 1542700569;
        language = "zh-Hans-CN";
        model = "iPhone7,1";
        "os_version" = "11.4.1";
        resolution = 1242x2208;
        timezone = "+8";
        type = "device_info";
    }
) log succed
| JIGUANG | D - [JIGUANGSessionController] Action - doSendTcpRequest
| JIGUANG | D - [JIGUANGTcpSocket] Got tcp command
| JIGUANG | D - [JIGUANGSessionController] Action - onAckOrRespReceived:
| JIGUANG | D - [JIGUANGSessionController] Action - doSendTcpRequest
| JIGUANG | D - [JIGUANGTcpSocket] Got tcp command
| JIGUANG | D - [JIGUANGSessionController] Action - doSendTcpRequest
| JIGUANG | D - [JIGUANGTcpSocket] Got tcp command
| JIGUANG | D - [JIGUANGSessionController] Action - doSendTcpRequest
| JIGUANG | D - [JIGUANGTcpSocket] Got tcp command
| JIGUANG | D - [JIGUANGSessionController] Action - onAckOrRespReceived:

(Ace") #8

这是我第二次打开App的时候给的日志信息:

| JIGUANG | I - [JIGUANGService] 
--------------------------- JPush Log ----------------------------
--------------------JPush SDK Version:3.1.1--build:66----------
--------------------JCore Lib Version:1.2.5--build:64----------
-----------------AppKey:bb72108c6a918ae0fa0a7e5f----------------
----------------------------------------------------------------
| JIGUANG | I - [JIGUANGClientController] Action - jpush setup
| JIGUANG | I - [JIGUANGClientController] Action - setup
| JIGUANG | D - [JIGUANGService] Action - registerDeviceToken: <0a404fb4 d9de7354 61214118 e05ebe11 1adc915c 09b8291c e49ce92e 8b9e72cb>
| JIGUANG | D - [JIGUANGService] Action - registerDeviceToken: <0a404fb4 d9de7354 61214118 e05ebe11 1adc915c 09b8291c e49ce92e 8b9e72cb>
| JIGUANG | D - [JIGUANGPageFlow] trySetupSession
| JIGUANG | D - [JIGUANGPageFlow] setupSession
| JIGUANG | D - [JIGUANGUserActiveReport] report content {
    date = "2018-11-20";
    duration = "3.3";
    itime = 1542701573;
    "session_id" = 90074b988e8b23b18fe703c5a23586ca;
    time = "15:56:04";
    timezone = "+8";
    type = "active_terminate";
}
| JIGUANG | D - [JIGUANGHttpSessionController] Action - setupSession
| JIGUANG | D - [JIGUANGNetworkController] Action - trySetupSession
| JIGUANG | D - [JIGUANGHttpSessionController] Action - setupSession
| JIGUANG | D - [JIGUANGNetworkController] userDefaut verified: 1
| JIGUANG | D - [JIGUANGUtilities] JCOREPostNotificationWithUserInfo name: kJPFNetworkIsConnectingNotification (null)
| JIGUANG | D - [JIGUANGSessionController] Action - connect
| JIGUANG | D - [JIGUANGSessionController] Action - isSisOnProtect
| JIGUANG | D - [JIGUANGSessionController] sis is not on protect
| JIGUANG | D - [JIGUANGSessionController] Action - reset sis cache
| JIGUANG | D - [JIGUANGAddressController] 开始Sis解析
| JIGUANG | D - [JIGUANGAddressController] Action - sendSisRequest
| JIGUANG | D - [JIGUANGUserDefaultsController] Action - setCurrentDeviceToken - 0a404fb4d9de735461214118e05ebe111adc915c09b8291ce49ce92e8b9e72cb
| JIGUANG | D - [JIGUANGDeviceTokenController] the same device token, not be updated again
| JIGUANG | D - [JIGUANGAddressController] get address :117.121.49.101 from host : s.jpush.cn
| JIGUANG | D - [JIGUANGTcpAddressSis] Action - sendSisRequest:toDefaultPort:toCustomPort
| JIGUANG | D - [JIGUANGUdpSocket] close udp socket,info:
| JIGUANG | D - [JIGUANGUdpSocket] send udp data
| JIGUANG | D - [JIGUANGUdpSocket] send udp data succeed
| JIGUANG | D - [JIGUANGUdpSocket] udp socket begin send behavior
| JIGUANG | D - [JIGUANGReport] send report:(
        {
        date = "2018-11-20";
        duration = "3.3";
        itime = 1542701573;
        "session_id" = 90074b988e8b23b18fe703c5a23586ca;
        time = "15:56:04";
        timezone = "+8";
        type = "active_terminate";
    }
) log succed
| JIGUANG | D - [JIGUANGReport] send report:(
        {
        date = "2018-11-20";
        itime = 1542701573;
        "session_id" = 475b9a4117a4ee672ed3648788c99295;
        time = "16:12:53";
        timezone = "+8";
        type = "active_launch";
    }
) log succed
| JIGUANG | D - [JIGUANGAddressController] get address :124.202.138.29 from host : sis.jpush.io
| JIGUANG | D - [JIGUANGTcpAddressSis] Action - sendSisRequest:toDefaultPort:toCustomPort
| JIGUANG | D - [JIGUANGUdpSocket] close udp socket,info:
| JIGUANG | D - [JIGUANGUdpSocket] send udp data
| JIGUANG | D - [JIGUANGUdpSocket] send udp data succeed
| JIGUANG | D - [JIGUANGUdpSocket] udp socket begin send behavior
| JIGUANG | D - [JIGUANGAddressController] get address :124.202.138.11 from host : easytomessage.com
| JIGUANG | D - [JIGUANGTcpAddressSis] Action - sendSisRequest:toDefaultPort:toCustomPort
| JIGUANG | D - [JIGUANGUdpSocket] close udp socket,info:
| JIGUANG | D - [JIGUANGUdpSocket] send udp data
| JIGUANG | D - [JIGUANGUdpSocket] send udp data succeed
| JIGUANG | D - [JIGUANGUdpSocket] udp socket begin send behavior
| JIGUANG | D - [JIGUANGSessionController] remove queued tcp request seq rid 33
| JIGUANG | D - [JIGUANGTcpAddressSis] Action - sendSisRequest:toDefaultPort:toCustomPort
| JIGUANG | D - [JIGUANGUdpSocket] close udp socket,info:
| JIGUANG | D - [JIGUANGUdpSocket] send udp data
| JIGUANG | D - [JIGUANGUdpSocket] send udp data succeed
| JIGUANG | D - [JIGUANGUdpSocket] udp socket begin send behavior
| JIGUANG | D - [JIGUANGTcpAddressSis] Action - parse
| JIGUANG | D - [JIGUANGTcpAddressSis] Action - parse ips address
| JIGUANG | D - [JIGUANGTcpAddressSis] Action - parseOptionAddress
| JIGUANG | D - [JIGUANGUdpSocket] close udp socket,info:
| JIGUANG | D - [JIGUANGSessionController] current network, ipv4
| JIGUANG | D - [JIGUANGSessionController] Action - connectTcp
| JIGUANG | D - [JIGUANGSessionController] Action - connectTcpAddress:
| JIGUANG | D - [JIGUANGSessionController] connectTcp:117.121.49.78:7006
| JIGUANG | I - [JIGUANGSessionController] connecting with coreAddr 117.121.49.78,port 7006
| JIGUANG | D - [JIGUANGTcpSocket] 连接主机成功
| JIGUANG | D - [JIGUANGTcpAddressSis] Action - sisReport:port
| JIGUANG | D - [JIGUANGUdpSocket] send udp data
| JIGUANG | D - [JIGUANGUdpSocket] send udp data succeed
| JIGUANG | D - [JIGUANGUtilities] JCOREPostNotificationWithUserInfo name: kJPUSHNetworkDidSetupNotification (null)
| JIGUANG | D - [JIGUANGSessionController] Action - doSendTcpRequest
| JIGUANG | D - [JIGUANGUdpSocket] udp socket begin send behavior
| JIGUANG | D - [JIGUANGTcpAddressSis] Action - parse
| JIGUANG | I - [JIGUANGLogin] 
----- login result -----
uid:15307545331 
registrationID:101d8559096cc7bbde4 
idc:1
| JIGUANG | D - [JIGUANGTcpSocket] Got tcp command
| JIGUANG | D - [JIGUANGSessionController] Action - onAckOrRespReceived:
| JIGUANG | D - [JIGUANGSessionController] Event - onLoginRespond
| JIGUANG | D - [JIGUANGUtilities] JCOREPostNotificationWithUserInfo name: kJPUSHNetworkDidLoginNotification (null)
| JIGUANG | D - [JIGUANGSessionController] Action - doSendTcpRequest
| JIGUANG | D - [JIGUANGTcpSocket] Got tcp command

#9

查看你第一次开启的日志


这个方法已经走了的,通知已经发过了。


(Ace") #10

也就是说我其实是已经登录成功了吗?那我再检查检查自己的代码设置顺序是否有错,先谢过大佬


(Ace") #11

我刚刚把监听事件放在其他地方以后可以监听到了,在监听到登录成功以后设置了别名,同时也返回了设置成功的log,但是还是收不到自定义消息。


#12

自定义消息前台接受不展示
排查并提供信息


(Ace") #13

好的,我再看看,谢谢


(Ace") #14

你好,我想问一下,如果我设置别名的时候回调给的iResCode参数值是6022,这个是否会是影响到我第一次收不到消息的原因呢?


#15

6022 上一次的 alias 请求还在等待响应,暂时不能执行下一次请求。 多次调用 alias 相关的 API,请在获取到上一次调用回调后再做下一次操作;在未取到回调的情况下,等待 20 秒后可做下一次操作。

如果推送消息的时候,别名还没有设置成功,那肯定是收不到消息的


别名设置成功了还是无法接收到消息