1
votes

I have spent "weeks" on and off on this issue. I've parked the iOS notification requirement and moved on to others. But now, I need to solve this problem.

I started with a Microsoft azure-notification-hub example...quite a few other samples/documents reference this sample code. https://docs.microsoft.com/en-us/xamarin/xamarin-forms/data-cloud/azure-services/azure-notification-hub

Send and receive push notifications with Azure Notification Hubs and Xamarin.Forms (posted 11/27/2019)

...and following the provided instructions exactly, I was initially able to use the Dispatcher project to send Azure Push Notifications to both iOS and Android.

After a week of enhancing this sample code with Location change detection and middle-tier calls, the iOS project just stopped working for no apparent reason. I created a new WinForms dispatcher project of which manages Azure Notification Hub registrations (view and delete only) and I could see both iOS and Android Azure device registrations. This replaced the command-line Dispatcher that came with the above example.

Occasionally, the iOS (actual iPhone) would begin receiving notifications. However, most of the time, the iPhone would not receive notifications and, quite a few times, would not even register with Azure. The Azure portal mirrored these findings.

** I have not had any problems "at all" with Android Firebase notifications being routed through Azure Notification Hub **

Eventually, I went back to the Microsoft supplied Azure Notification Hub example mentioned above to re-baseline. Even that known-good, previously working example exhibited the same iOS issues (occasionally not registering with Azure, and more than often not receiving notifications when registered).

I pulled an all night-er last night in an attempt to resolve this issue or at least establish a pattern in which this issue occurs, and even more importantly, how to reset my baseline such that it works. For a while the below process seemed to work about 80% of the time...

1) Manually delete all Azure Notification Hub registrations using my modified Dispatcher WinForms app. 2) Remove the app from both the physical iPhone and the Android emulated devices. 3) Stop Visual Studio 2019 4) !!! Turn off the iPhone and wait for at least 20 minutes !!! 5) Turn on the iPhone 6) Start Visual Studio 2019 and load the baseline project mentioned above. 7) Execute with iOS, Android, and Dispatcher projects in DEBUG mode.

With this process the iPhone will register and begin receiving Azure Push Notifications ... usually 20 ~ 30 seconds behind the immediate Android notification receipt. This process does not always work...and it takes a lot of time.

Now, the iOS device (physical iPhone) will register about 40% of the time and no longer receives push notifications.

On a whim, I created a second Azure notification hub and experienced the exact same iOS problems.

Surely, I cannot be the only person on the planet having these problems.

My team is depending on my getting solid push notifications to work on both iOS and Android.

Any help would be greatly appreciated, just a shove in the right direction. My sanity depends on it.

Many thanks, Don

MacBook Air macOS Catalina 10.15.4 Xcode versions 11.4.1 (11E503a)

PC Windows 10 Pro version 1909 OS build 18363.778 Visual Studio 2019 version 16.5.4 Xamarin.Forms 4.5.0.617 Microsoft.Azure.NotificationHubs version 3.3.0

2

2 Answers

0
votes

I have determined what was causing this and I have to say that I am !@#$'ing amazed at Apple for causing this to happen.

An Apple Developer Program and License Agreement update is what totally crippled push notification development for an entire week. Unbelievable. No error messages, warnings, or email. Just suddenly iOS push notifications stopped working.

On a last ditch whim I decided to check my Apple Developer Account for warning messages or alerts. When I logged in I had encountered that large red account banner indicating a license agreement update. I am not the primary Apple Developer Account holder so I had to contact our Customer and ask them to read and/or click through it. About a year ago I was unable to upload our iOS app to App Center (or whatever it is called today) for the same reason.

0
votes

This "a" problem, but not "the" problem. My iOS Xamarin builds are hanging over 50% of the time.