Closed chrisparkeronline closed 4 years ago
Thank you for reporting this, will put some time aside to try to reproduce this and find a solution for you! Can you confirm with the location permission prompt if this happens also?
Hello,
Yes calling OneSignal.Current.PromptLocation(); dialog causes the interface to freeze as well.
I did some more investigating. Change the code to this so that I could call registration from other places in the code;
OneSignal.Current.SetLocationShared(false);
OneSignal.Current.StartInit("[My Id]")
.UnsubscribeWhenNotificationsAreDisabled(true)
.HandleNotificationReceived(HandleNotificationReceived)
.HandleNotificationOpened(HandleNotificationOpened)
.InFocusDisplaying(OSInFocusDisplayOption.None)
.Settings(new Dictionary<string, bool>() {
{ IOSSettings.kOSSettingsKeyAutoPrompt, false },
{ IOSSettings.kOSSettingsKeyInAppLaunchURL, false } })
.EndInit();
Using the kOSSettingsKeyAutoPrompt turns off the auto prompting. I can confirm, no matter where I call "OneSignal.Current.RegisterForPushNotifications();" the prompt freezes that contentpage's controls every time.
The prompt does set the "subscribed" setting to true. So it is posting the information back to your servers.
Sorry for the rapid fire of posts. Right after I posted the last message I put this following code in the "OnAppearing" method a contentpage and it worked fine.
protected override void OnAppearing()
{
base.OnAppearing();
MainThread.BeginInvokeOnMainThread(() =>
{
OneSignal.Current.RegisterForPushNotifications();
});
}
More information the better, thank you for all of this!
Hi, I can't speak for anyone else but I think this ticket should be closed, here is why. When the app launches the StartInit method is called. This causes iOS to ask for the notifications permissions, as it should. I just found out that iOS puts the app in sleep mode (OnSleep is called) until the user responds. Once the user responds, the app resumes (OnResume is called). In my OnResume I had a task that runs that blocks the thread, causing my app to freeze.
BOTTOM LINE IT IS MY CODE. I'm man enough to admit that I made the mistake, not OneSignal! Sorry team @mikechoch @rgomezp
Thanks for the response @chrisparkeronline Enjoy!
Using the latest version of both OneSignal and Xamarin Forms 4.5.0.617, the UI freezes. Selecting the notifications permission dialog that is presented to user when app loads for the first time. Regardless what option is chosen, my UI is no longer responsive. The app has to be shutdown then restarted and everything works as coded.
It's as if the permissions dialog is still blocking the UI even after it visually is removed.
Environment Xamarin Forms v 4.5.0.617 OneSignal v 3.8.1 Test Device: iPhone11,8 (13.3.1)
Steps to Reproduce Issue:
Log Information Verbose information outputed to the log window within Visual Studio Mac
Code