-
Notifications
You must be signed in to change notification settings - Fork 1.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Not compatible with iOS 13 background push notifications #909
Comments
+1 |
Hello @Redth, Seems like you are very busy with other projects, but this issues looks very critical. Maybe you can find several minutes/hours to look at this problem? Or at least maybe you can give us an advice how to fix/workaround this, please? I found that you generate request's headers as list of bytes, for example: PushSharp/PushSharp.Apple/ApnsNotification.cs Lines 117 to 133 in f68bb1e
How do you know that device token is 0x01, payload is 0x02, identifier is 0x03 and so on? |
The 0x01 and 0x02 is according to the "Provider API" schema from Apple. |
Hey @AlexBrownShi, @margaritamejia, @ManeyYamazin, I was able to send pushes to my app wihout changes in PushSharp (for now, at least). For example,
new format:
So wrong push token (device token) was the reason why I was not able to send push to my app. You can use the following code to 'repair' new token format:
For more details read this. P.S.: it should be mentioned that I develop iOS app only; watchOS still needs the solution. |
@Alexander-Alekseev I don't think we can use the lagacy format to send silent notification to iOS 13 devices. as per Apple we need to add new header apns-push-type Check this out, PushSharp uses lagacy headers and you cannot add a new header apns-push-type I think the solution is use HTTP/2 : |
This doesnt work. I tested in PushSharp 2.2.1.0. The new header apns-push-type is required for IOS 13:
Documentation at: https://developer.apple.com/documentation/usernotifications/setting_up_a_remote_notification_server/sending_notification_requests_to_apns |
Using linked HTTP/2 solution (Core Push library) works, with one caveat. You need to use either Windows 10 or Windows Server 2016 or later. Otherwise you run into cipher issues with Apple server. |
It seems there is no solution for Binary Provider API, cause there is no section for apns-push-type in the documentation:https://developer.apple.com/library/archive/documentation/NetworkingInternet/Conceptual/RemoteNotificationsPG/LegacyNotificationFormat.html#//apple_ref/doc/uid/TP40008194-CH14-SW1. Am I wrong? |
Well, it's pretty old. I was using v4.0.10.
Wrong. apns-push-type required for watshOS 6, but recommended for iOS. Anyway, it could be required for iOS once.
You are right, there is no solution for Binary Provider API. For all of you who reads this topic: if you already have your own server in production which is huge and written in .NET Framework 4.5+ there is a solution without moving to .NET Core and HTTP/2. The solution is to use FCM and this sender - https://github.com/andrei-m-code/net-core-push-notifications/blob/master/CorePush/Google/FcmSender.cs (though original project was written in .NET Core, this sender perfectly works with .NET FW 4.5.1 and I think it works even with 4.5). As a result: the pointed sender (which is very small!) replaces the whole PushSharp (if you are interesting in iOS and/or Android only). |
Then PushSharp.Google.GcmServiceBroker should also be able to send notifications to iOS devices, shouldn't it? |
@ArkaitzOB, I didn't think about it, but yeah, it should (of course if you change GCM address to FCM). Anyway, in our server we decided to move from PushSharp as it's no longer maintainable. |
Indeed, it's a pity as the OnNotificationFailed event was useful to delete expired tokens from DB. |
I added empty alert with someone recommended and it worked. Add Alert {title="tiredOf", message="AppleWorkaround"} |
@AlexBrownShi , try this payload for silent push. It works on iOS 13. I sent silent/background push along with sound and custom data with following payload: |
What version of PushSharp are you using?
4.0.10.0
Describe your issue:
Background push notifications are not received by iOS 13 devices properly.
What are the steps required to reproduce this issue?
Send a background push notification by specifying: aps-content-available:1 and payload.
Please provide any Exception Stack Traces
No exception. Notification sends properly, but never received as a background notification. Possible it is received as a foreground notification, not sure.
See the following in iOS Notifications documentation:
https://developer.apple.com/documentation/usernotifications/setting_up_a_remote_notification_server/sending_notification_requests_to_apns
Excerpt on Headers:
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.
I only see headers being used when using HttpTwo. If that is working, the fix may not be too complex.
The text was updated successfully, but these errors were encountered: