Azure / azure-notificationhubs-xamarin

Azure Notification Hubs Sample for Xamarin Forms
MIT License
35 stars 23 forks source link

[BUG] iOS push notifications not received to physical device from Azure #26

Open ghost opened 3 years ago

ghost commented 3 years ago

Describe the bug Originally posted on stackoverflow, was recommended by a Microsoft support engineer to post here: https://stackoverflow.com/questions/64768446/ios-push-notification-not-received-to-physical-device-from-azure

I follow this Microsoft guide rigorously but push notifications don't come through to the physical device: https://docs.microsoft.com/en-us/azure/notification-hubs/xamarin-notification-hubs-ios-push-notification-apns-get-started

Exception or Stack Trace RegisteredForRemoteNotifications is called successfully, but ReceivedRemoteNotification is never called when I send a Test Send from Azure. No obvious errors or exceptions come through. However, inside the .iOS project, within the method RegisteredForRemoteNotifications, I have noticed that when I hover over my SBNotificationHub instance, under the class handle it gives an error: "Unable to cast object of type 'Mono.Debugger.Soft.PointerValue' to type 'Mono.Debugger.Soft.PrimitiveValue'." Not sure if this has anything to do with my problem.

To Reproduce Steps to reproduce the behavior: On a PC with visual studio 2019 (Connected to a Mac over local network) and connect an iPhone to the Mac via lightning cable. Make sure device is connected to WIFI/phone network, create a new Xamarin project for android and iOS. Use only the code from this Microsoft guide:

https://docs.microsoft.com/en-us/azure/notification-hubs/xamarin-notification-hubs-ios-push-notification-apns-get-started.

Send a Test Send from Azure.

Expected behavior A push notifcation should come through to the physical iPhone,

Setup (please complete the following information):

ghost commented 3 years ago

I forgot to add, the iPhone does pop up with a permission request for push notifications, which I accept.

pavloss commented 3 years ago

I'm experiencing the same behaviour with a different framework. Underlying class handle also gives: Unable to cast object of type 'Mono.Debugger.Soft.PointerValue' to type 'Mono.Debugger.Soft.PrimitiveValue'.

c0demak3r commented 3 years ago

I'm experiencing the exact same as shown above, following exactly the same Microsoft docs article and verbatim code. The counterpart Xamarin.Android knowledge article and Azure Notification Hub Tests work perfectly.

nativenolde commented 3 years ago

Is there any news about this?

matscr commented 3 years ago

Any recent news?

mpodwysocki commented 3 years ago

@DopaFiend @matscr and others, we are updating the documentation to use the latest APIs that should be merged soon https://github.com/MicrosoftDocs/azure-docs/pull/68800

We are aware of the bug in the legacy APIs due to threading issues and are advising people to use the new APIs

shaytate commented 3 years ago

Could someone assist me with this? I am still not receiving any notification message that hits DidReceivePushNotification. I see success messages in Azure when sending. I followed the latest documentation fully. I am using the following:

Windows 10 PC, connected to a Mac over local network.
Visual Studio 2019 v16.8.6
Xamarin.Azure.NotificationHubs.iOS v3.1.1
iphone 7 v14.4 (Connected via lightning cable)
Xcode 12.4