【发布时间】:2017-03-28 18:18:32
【问题描述】:
我们从 UA 迁移到 One Signal。我们正在从云代码发送推送,例如
var pushInfo = {
"app_id" : "xxxxxx",
"data": {
"objectId": objectId,
"placeId": placeId,
},
"included_segments": ["All Users"],
"contents": {"en": message}
};
var headers = {
"Content-Type": "application/json; charset=utf-8",
"Authorization": "Basic XXXXX"
};
var options = {
host: "onesignal.com",
port: 443,
path: "/api/v1/notifications",
method: "POST",
headers: headers,
};
var https = require('https');
var req = https.request(options, function(res) {
res.on('data', function(data) {
console.log("Response:");
console.log(JSON.parse(data));
});
});
req.on('error', function(e) {
console.log("ERROR:");
console.log(e);
});
req.write(JSON.stringify(pushInfo));
req.end();
在我的 AppDelegate.m 中
[OneSignal initWithLaunchOptions:launchOptions appId:@"XXXXX"];
现在早些时候,当收到通知并且用户点击它时,它曾经调用过
-(void) application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo fetchCompletionHandler:(void (^)(UIBackgroundFetchResult))completionHandler
问。现在没有调用它。如何使用 OneSignal 处理它。 问:我需要做些什么来处理无声通知(没有可见的徽章/横幅等)
【问题讨论】:
标签: ios push-notification apple-push-notifications onesignal