卸载重装提示获取不到 token

my.zhao
2018-05-15 09:53 4k 0

生产环境ios 从appstore第一次安装app时,推送是正常的可以收到,卸载后重装 一直提示Not get deviceToken yet,第一次能成功证明配置没问题把!开发环境没有任何问题。

代码这样写的

// 注册jpush的id
    var getRegistrationID = function() {    
        window.JPush.getRegistrationID(onGetRegistrationID);
    };

    var onGetRegistrationID = function(data) {
        jpush_num += 1
        try {
            alert('registrationID is: ' + data)
            if (data.length == 0) {
                window.JPush.isPushStopped(function (result) {
                    alert('推送状态:' + result)
                    if (result != 0) {
                        window.JPush.resumePush()
                        if (jpush_num < 6){
                            window.setTimeout(getRegistrationID, 1000);
                        }
                    }
                })
            }
        } catch (exception) {}
    };

    var initiateUI = function() {
        try {
            // 极光初始化
            window.JPush.init();
            window.JPush.setDebugMode(true);
            if (device.platform != "Android") {
                window.JPush.setDebugModeFromIos();
            }
            window.JPush.getUserNotificationSettings(function(result) {
                alert('系统是否打开了推送:' + JSON.stringify(result))
            })
            window.setTimeout(getRegistrationID, 1000);
        } catch (exception) {
            alert(exception)
        }
    }

    document.addEventListener("deviceready", onDeviceReady, false);

2个回答

热门排序