J'utilise le package Xam.Plugins.Notifier pour implémenter Local Notification dans le projet Xamarin.Forms.Xam.Plugins.Notifier ne fonctionne pas sur IOS 11
Voici le code que j'ai écrit dans le projet PCL. CrossLocalNotifications.Current.Show ("Titre", "Description");
Cela fonctionne bien sur Android, mais cela ne fonctionne pas sur IOS. Je ne suis pas sûr si cela fonctionne sur SDK inférieur IOS. Quoi qu'il en soit, il ne fonctionne pas sur IOS 11.
Voici le code que j'ai ajouté dans AppDelegate.cs
if (UIDevice.CurrentDevice.CheckSystemVersion(10, 0))
{
// Ask the user for permission to get notifications on iOS 10.0+
UNUserNotificationCenter.Current.RequestAuthorization(
UNAuthorizationOptions.Alert | UNAuthorizationOptions.Badge | UNAuthorizationOptions.Sound,
(approved, error) => { });
}
else if (UIDevice.CurrentDevice.CheckSystemVersion(8, 0))
{
// Ask the user for permission to get notifications on iOS 8.0+
var settings = UIUserNotificationSettings.GetSettingsForTypes(
UIUserNotificationType.Alert | UIUserNotificationType.Badge | UIUserNotificationType.Sound,
new NSSet());
UIApplication.SharedApplication.RegisterUserNotificationSettings(settings);
}
Quelqu'un peut-il me aider à résoudre ce problème? Je veux que ce paquet fonctionne sur IOS.
Merci.
merci pour votre réponse, je l'ai déjà manipulé moi-même. Ce qui devrait être ajouté si cela ne fonctionne pas quand il est en arrière-plan. –
@ Passionate.C Le code que vous avez fourni devrait fonctionner en arrière-plan. –