Closed HollowAccount closed 4 months ago
You need to provide a full sample showing the issue
3.3.3 has been tested here: https://github.com/shinyorg/pushtester and verified to be working
@aritchie
3.3.3 has been tested here: https://github.com/shinyorg/pushtester and verified to be working
This sample repository additionally uses Shiny.Push.FirebaseMessaging and Shiny.Push.AzureNotificationHubs I am not analyzing the use of these additional libs.
My solution is based on a "basic" implementation:
I forked the source code of the entire library to analyze why it doesn't work. And as I suspected, there are multiple instances registered for PushManager:
In the case of iOS, this leads to an error because we call the RequestAccess method from the IPushManager interface, while IosLifecycleExecutor uses an instance resolved from the IIosLifecycle.IRemoteNotifications interface.
To show what the problem is, I added the "Guid" identifier to the PushManager service. Value at the time of executing the RequestAccess method:
Here is another instance with a different identifier on which operations are performed in IosLifecycleExecutor.
For Android it does not matter, but in the case of iOS we wait for the result for the TaskCompletionSource which is never completed because SetResult is made for a completely different instance than we expect.
This sample repository additionally uses Shiny.Push.FirebaseMessaging and Shiny.Push.AzureNotificationHubs I am not analyzing the use of these additional libs
These are built on top of the "basic" implementation
For Android it does not matter, but in the case of iOS we wait for the result for the TaskCompletionSource which is never completed because SetResult is made for a completely different instance than we expect.
If you want me to look at this, you have to supply a reproducible sample or this will be locked.
Component/Nuget
Push - Native (Shiny.Push)
What operating system(s) are effected?
Version(s) of Operation Systems
iOS 17.2 (physical device) and others
Hosting Model
Steps To Reproduce
Android: works fine iOS: never returns the task result and hangs
Expected Behavior
The RequestAccess method should return a value.
Actual Behavior
When the RequestAccess method is called, nothing happens and the tank result is never returned.
In AppDelegate for RegisteredForRemoteNotifications I get the appropriate deviceToken which is then passed to OnRegisteredForRemoteNotifications():
I don't know why, but this PushManager method is not called:
public void OnRegistered(NSData deviceToken) => this.tokenSource?.TrySetResult(deviceToken);
As a result, in the RequestRawToken method we wait forever for the result from the TaskCompletionSource tokenSource.
It looks as if PushManager is not a singleton at all or the OnRegisteredForRemoteNotifications method uses a different PushManager instance than the one registered for the application.
Exception or Log output
No response
Code Sample
No response
Code of Conduct