我正在使用Xamarin.iOS,我知道在iOS 10 +上已弃用 ReceivedLocalNotification
所以我实施了:
UNUserNotificationCenter.Current.Delegate = new UserNotificationCenterDelegate();
导致以下内容:
public class UserNotificationCenterDelegate : UNUserNotificationCenterDelegate {
public UserNotificationCenterDelegate() { }
public override void WillPresentNotification(UNUserNotificationCenter center, UNNotification notification, Action<UNNotificationPresentationOptions> completionHandler)
{
completionHandler(UNNotificationPresentationOptions.Alert);
}
public override void DidReceiveNotificationResponse(UNUserNotificationCenter center, UNNotificationResponse response, Action completionHandler)
{
....
}
}
我正在使用iOS 10 / iOS 11和本地通知在后台触发,但我无法获得该事件。
在没有用户与之交互的情况下触发本地通知时,甚至可以获取事件吗?