每当我尝试使用OneSignaL发布通知时,我都会收到此错误:
listpairs([H], H, H).
listpairs([H1,H2|T], X, Y) :-
X is H1,
Y is H2,
listpairs([H2|T], X, Y).
这是我的代码:
app_id not found. You may be missing a Content-Type: application/json header
我添加了' Content-Type'部分是因为错误说的是什么,但我仍然得到同样的错误。这是来自docs的示例代码striaght - 他们甚至不包括Content-Type:
function notifyUser(id, msg) {
var notificationObj = { contents: {en: msg},
include_player_ids: [id],
'Content-Type': 'application/json' };
window.plugins.OneSignal.postNotification(notificationObj,
function(successResponse) {
console.log("Notification Post Success:", successResponse);
},
function (failedResponse) {
console.log("Notification Post Failed: ", failedResponse);
alert("Notification Post Failed:\n" + JSON.stringify(failedResponse));
}
);
};
答案 0 :(得分:-1)
没关系,我想出来了。我在运行测试时注释掉了OneSignal的设置部分。