Search code examples
xamarinxamarin.iosazure-notificationhubios13

App crashes hard in UnregisterAllAsync when trying to run in iOS 13 in Xamarin.iOS


Pretty simple code works fine in iOS 12, but when working with the new previews for iOS 13, I get pretty hard crashes SIGSEGV with the following code:

Hub.UnregisterAllAsync(deviceToken, (error) =>
                {
                    if (error != null)
                    {
                        System.Diagnostics.Debug.WriteLine("Error calling Unregister: {0}", error.ToString());
                        return;
                    }

                    string[] tags_array = AppDelegate.notificationTags.ToArray();
                    NSSet tags = new NSSet(tags_array);
                    Console.WriteLine($"tags after unmount: {tags}");

                    Hub.RegisterNativeAsync(deviceToken, tags, (errorCallback) =>
                    {
                        if (errorCallback != null)
                            System.Diagnostics.Debug.WriteLine("RegisterNativeAsync error: " + errorCallback);
                    });
                });

There is no update for Xamarin.Azure.NotificationHubs.iOS in the last couple of years. It only seems to affect iOS 13.

It looks like it hits SBNotificationHubHelper signString:withKeyData:keyLength, then crashes into native code. No breakpoints are hit


Solution

  • Somebody did the fix for iOS native lib, if somebody could just convert to C# and update the Xamarin Azure Notification Hub iOS package, it would be awesome.

    https://github.com/xamarin/XamarinComponents/issues/676#issuecomment-536899918