我正在获取APN无效参数:JSON必须包含“默认”或“ APNS_SANDBOX”的条目。日志在这里
代码块在这里:
该如何解决?这是内置在Scala lift框架中的。
这是javascript中的示例。同理,我们要使用。需要用例 1.APNS_沙盒 2.APNS 3.默认
// Setup SNS Client
const snsClient = new SNS();
// whatever your full endpoint arn is. (from createPlatformEndpoint)
const endpointArn = 'arn:aws:sns:...';
// any extra data you want passed along with the message
const payload = {
someCustomKey: 'someCustomValue'
};
// send it
snsClient.publish({
TargetArn: endpointArn,MessageStructure: 'json',// so we can put in a custom payload and message
Message: JSON.stringify({
default: `DEFAULT MESSAGE ${message}`,APNS_SANDBOX: JSON.stringify({
aps: {
alert: `IOS Sandbox SPECIFIC MESSAGE ${message}`,},payload,}),APNS: JSON.stringify({
aps: {
alert: `IOS Prod SPECIFIC MESSAGE ${message}`,}).promise().then(() => {
console.log('Notification sent!');
}).catch((err) => {
console.log('Failed to send with:',err);
});