我当前有Azure Notifications问题 - 我已经配置了所有生产的内容,并通过发送测试通知来确认此功能。但是,在应用程序中的第一个" registerforpushnotifications"之后,下次我打开它时,我会记录以下错误:
PID[11096] Information Sending response: 400.0 <Error><Code>400</Code><Detail>Installation validation failed with following error(s):
An invalid tag(s) '_UserId:facebook|10211219930003961,NewVenue' was supplied. Valid tag characters are alphanumeric, _, @, -, ., : and #..TrackingId:9315e728-8777-4cad-a475-956c38dcde36_G6,TimeStamp:4/23/2017 9:09:06 AM</Detail></Error>
我正在使用所提供的样板代码从Cordova(Ionic(应用程序进行推动。我不明白我出错了哪里。我想解决这个问题,因为目前这是生产中的问题。
订阅代码:
function registerForPushNotifications() {
pushRegistration = PushNotification.init({
android: {
senderID: '<id>'
},
ios: {
alert: 'true',
badge: 'true',
sound: 'true'
},
wns: {}
});
// Handle the registration event.
pushRegistration.on('registration', function(data) {
// Get the native platform of the device.
if (device) {
debugger
var platform = device.platform;
// Get the handle returned during registration.
var handle = data.registrationId;
// Set the device-specific message template.
if (platform == 'android' || platform == 'Android') {
// Register for GCM notifications.
window.azureClient.push.register('gcm', handle.replace("|",""), {
mytemplate: {
body: {
data: {
message: "{$(messageParam)}"
}
}
}
});
} else if (device.platform === 'iOS') {
// Register for notifications.
window.azureClient.push.register('apns', handle.replace("|",""), {
mytemplate: {
body: {
aps: {
alert: "{$(messageParam)}"
}
}
}
});
} else if (device.platform === 'windows') {
// Register for WNS notifications.
window.azureClient.push.register('wns', handle.replace("|",""), {
myTemplate: {
body: '<toast><visual><binding template="ToastText01"><text id="1">$(messageParam)</text></binding></visual></toast>',
headers: {
'X-WNS-Type': 'wns/toast'
}
}
});
}
}
});
pushRegistration.on('notification', function(data, d2) {
alert('Push Received: ' + data.message);
});
pushRegistration.on('error', function(err) {
console.warn("error", err)
});
}
Apache Cordova的Azure Mobile Apps SDK SDK尚不适合安装。您需要对/push/installations/{applicationId}
端点进行HTTP POST请求(这是推动刀片为您配置的端点(。身体必须是通知中心的有效安装对象。
我使用C#作为我的书(http://aka.ms/zumobook(中的语言进行了讨论。这将使您可以微调发送的推动参数,因为您发送了与推送对象直接相关的配置对象。