我們從UA遷移到One Signal。我們就像OneSignal未調用didReceiveRemoteNotification
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。 問:我需要做什麼來處理無聲通知(無可見的徽章/橫幅等)
謝謝。可能僅僅使用[OneSignal initWithLaunchOptions:launchOptions appId:@「XXXX」handleNotificationReceived:^(OSNotification * notification){}將是一個不錯的主意,它將始終跨越iOS8/9/10 – user1191140