Reputation: 521
Since the public release of iOS 13 push notifications appear to no longer work for my Xamarin.Forms iOS project. I currently use Azure Notification Hub to send test notifications and previously, my iPhones would get notifications with no problem. Since iOS13 this is no longer happening.
I don't use OneSignal but they did post an article about the changes that were made for Push Notifications: https://onesignal.com/blog/ios-13-introduces-4-breaking-changes-to-notifications/
Is this problem still present? Or has anyone got any sources to confirm this issue other than SignalOne?
public override void RegisteredForRemoteNotifications(UIApplication application, NSData deviceToken) {
if (Hub == null) {
Hub = new SBNotificationHub(ApiConstants.ListenConnectionString, ApiConstants.NotificationHubName);
}
// Following from the comments with FreakyAli, I have added these 3 lines
Byte[] result = new byte[deviceToken.Length];
Marshal.Copy(deviceToken.Bytes, result, 0, (Int32)deviceToken.Length);
String token = BitConverter.ToString(result).Replace("-", "");
// Update registration with Azure Notification Hub
Hub.UnregisterAllAsync(token, (error) => {
if (error != null) {
Debug.WriteLine($"Unable to call unregister {error}");
}
NSSet tags = null;
Hub.RegisterNativeAsync(deviceToken, tags, (errorCallback) => {
if (errorCallback != null) {
Debug.WriteLine($"RegisterNativeAsync error: {errorCallback}");
}
});
});
}
The code above worked all the time but during debugging I have noticed it no longer steps into Hub.UnregisterAllAsync()
and I believe it is causing some error? (Can't make any sense of it though)
=================================================================
Basic Fault Address Reporting
=================================================================
Memory around native instruction pointer (0x1bffaaf44):
0x1bffaaf34 c0 03
5f d6 1f
20 03 d5
1f 20
03 d5 01 ec
7c 92
.._..
...
..
..|
.
0x1bffaaf44 20 00 c0 3d c3 f9 ff 10
62 04 c1 3c 02 0c 40 92
..=.
..
.b.
.<.
.@.
0x1bffaaf54
63 00 02
cb 61 00
c0 3d 00 1c a1 4e
05 00
00
14
c.
..
a.
.=.
.
.
N....
0x1bffaaf64 1f 20 03 d5
1f 20 03 d5 1f 20 03 d5 20 0c
c1 3c . ..
. ... .. ..<
I have found these though - but I'm unsure how related these are to my current problem. https://github.com/Azure/azure-notificationhubs-dotnet/issues/88 https://github.com/Azure/azure-notificationhubs-dotnet/issues/96
Upvotes: 4
Views: 2332
Reputation: 838
They recently changed their token , you need to make minor changes follow this link https://dev.to/codeprototype/correctly-capture-ios-13-device-token-in-xamarin-1968
Upvotes: 1