使用 Azure 向 iOS 台设备发送额外的推送通知数据

Send additional push notification data to iOS devices using Azure

我正在尝试根据我从本教程中学到的知识通过 Azure 移动服务向 iOS 设备发送一些数据 https://github.com/ggailey777/mobile-services-samples/tree/master/CordovaNotificationsArticle ,

但是,当我像这样在 azure 上设置负载时

var payload = '{ "message" : "' + message + '", "title" : "Title...", "id" : "' + recordid + '"  }';

只有 Android 设备可以接收有关 Cordova 推送插件通知事件的附加数据,但在 iOS 上,除 data.message 之外的任何内容都是未定义的。

push.on('notification', function (data) {
    var recordID = data.additionalData.id
});

这是我的注册码:

    var push = PushNotification.init({
        "android": { "senderID": AzureMobileServiceClient.senderID },
        "ios": { "alert": true, "badge": true, "sound": true }
    });

    push.on('registration', function (data) {

            //// Call mobile service client here 
            var mobileServiceClient = new WindowsAzure.MobileServiceClient(AzureMobileServiceClient.API_URL, AzureMobileServiceClient.API_KEY);

            // Get the native platform of the device. 
            var platform = "";
            if (ionic.Platform.isIOS()) {
                platform = "iOS";
            }
            else {
                platform = "android";
            }

            var tags = [userid, platform];
            // Get the handle returned during registration. 
            var handle = data.registrationId;
            // Set the device-specific message template. 
            if (platform == "android" || platform == "Android") {
                // Template registration. 
                var template = '{ "data" : {"message":"$(message)", "id": "$(id)", "title": "$(title)"}}';
                // Register for notifications. 
                mobileServiceClient.push.gcm.registerTemplate(handle,
                    "myTemplate", template, null, tags)
                    .done(registrationSuccess, registrationFailure);
            } else if (platform == "iOS") {

                // Template registration. 
                var template = '{"aps": {"alert": "$(message)"}}';

                // Register for notifications.             
                mobileServiceClient.push.apns.registerTemplate(handle,
                    "myTemplate", template, null, tags)
                    .done(registrationSuccess, registrationFailure);
            }

        });

有谁知道如何在 iOS 上获取更多数据?非常感谢任何帮助。

谢谢!

iOS客户端应用注册模板如下:

{"aps": {"alert": "$(message)"}}