xCode に PhoneGap 2.5 アプリケーションがあります。UrbanAirship ライブラリを正しくインストールしましたが、デバイスの PushId を取得する必要があります。
次のコードを使用すると、psuh boject は常に null になります。プラグインが適切なデータを返すことを xCode デバッグ コンソールで確認できますが、PhoneGap プラグインに渡されていないようです。
誰でも同じ問題がありますか?それを解決する方法は?
デバッグ コンソール
-[UAUser retrieveRequestSucceeded:] [Line 873] User retrieved: 200:{
"user_id" : "UMS5WHefShemIAx9VqjlDA",
"user_url" : "https://device-api.urbanairship.com/api/user/UMS5WHefShemIAx9VqjlDA/",
"tags" : [ ],
"device_tokens" : [ ],
"device_pins" : [ ],
"apids" : [ ],
"has_active_subscription" : false,
"subscriptions" : [ ],
"ua_device_ids" : [ "0C028CFD-AA85-4C52-BD50-F8520D8A973D" ],
"badge" : 0,
"server_time" : "2013-05-28 09:47:56"
}
index.html のコード
function onDeviceReady()
{
console.log('The Device is Ready!');
push = window.pushNotification;
console.log('+++ PUSH OBJ ' + push);
console.log('+++ PUSH OBJ JSON: ' + JSON.stringify(push));
push.registerEvent('registration', function(error, id) {
console.log('+++ registration Starts.');
console.log('+++ error is:' + error);
console.log('+++ id is:' + id);
/*
if(!error)
{
console.log("+++ ID: " + id);
window.pushNotificationTokenId = id;
}
else {
console.log("AAA Push id regires error: "+error);
}
*/
});
// Activate the
push.getPushID(function(id) {
console.log('+++ push.getPushID id is: ' + id);
if (id) {
console.log("XXX Got push ID: " + id);
window.pushNotificationTokenId = id;
}
else {
console.log("XXX Push id is undefined");
}
});
}