我可以控制台记录玩家ID,但是无法存储在变量中,我想知道如何处理它?</ p>
2018-08-02 12:11:19.246673+0800 [1190:62191] Player ID:undefined
2018-08-02 12:11:19.289098+0800 (Player id)xxxxx-xxxx-xx-xx-xxxx
JavaScript:
$ionicPlatform.ready(function() {
var notificationOpenedCallback = function(jsonData) {
console.log('notificationOpenedCallback: ' + JSON.stringify(jsonData));
};
window.plugins.OneSignal
.startInit("XXXXXXXXX")
.handleNotificationOpened(notificationOpenedCallback)
.endInit();
window['plugins'].OneSignal.getIds((id) => $localStorage.uuid = id.userId);
console.log("Player ID:" + $localStorage.uuid);
window['plugins'].OneSignal.getIds((id) => console.log(id.userId));
})