Closed olegorelwork closed 4 years ago
Probably, the SDK needs to support apns-push-type
header which is required for delivering notifications to devices running iOS 13.
Apple doc says about apns-push-type
:
(Required when delivering notifications to devices running iOS 13 and later, or watchOS 6 and later. Ignored on earlier system versions.) The type of the notification. The value of this header is alert or background. Specify alert when the delivery of your notification displays an alert, plays a sound, or badges your app's icon. Specify background for silent notifications that do not interact with the user.
The value of this header must accurately reflect the contents of your notification's payload. If there is a mismatch, or if the header is missing on required systems, APNs may delay the delivery of the notification or drop it altogether.
For information about configuring notification alerts, see Generating a Remote Notification. For more information about sending background notifications, see Pushing Background Updates to Your App.
From the OneSignal Rest API documentation and from this article - Note: alert and background are automatically set by OneSignal.
So this is probably not an issue with the sdk. Or it has been an issue with OneSignal for some small window of time. This issue can be closed.
Does anyone know the condition when OneSignal automatically sets push type to background
?
const notification = new OneSignal.Notification();
notification.app_id = process.env.ONESIGNAL_APP_ID;
notification.include_external_user_ids = ["user1"];
notification.content_available = true;
notification.mutable_content = true;
notification.data = { foo: "bar" };
This is my notification struct and I don't think background
is being set. Because when I manually tested with Apple Push Notification tool with the same payload it works fine. And If I add alert
it also works fine. Just background isn't. I think the problem is between OneSignal and APN.
{ description: 'OTRN error', code: 1011, message: 'The operation couldn't be completed. (OTSessionErrorDomain error 1011.)' }