简体   繁体   English

不应使用 Xamarin.Forms 刷出 iOS 的通知

[英]Should not be swipe out the notification for iOS using Xamarin.Forms

I am using Xamarin.Forms.我正在使用 Xamarin.Forms。 I want the notification on notification bar not to be swiped out on both Android and iOS.我希望通知栏上的通知不要在 Android 和 iOS 上被刷掉。 For Android, I am using SetOnGoing(true) on notification builder.对于 Android,我在通知生成器上使用SetOnGoing(true) However, I cannot achieve that one on iOS.但是,我无法在 iOS 上实现这一目标。 I am using the following override method on iOS:我在 iOS 上使用以下覆盖方法:

public override void WillPresentNotification(UNUserNotificationCenter center, UNNotification notification, Action<UNNotificationPresentationOptions> completionHandler)
{
    completionHandler(UNNotificationPresentationOptions.Alert);
}

Can anyone help me to resolve this issue?谁能帮我解决这个问题?

Unfortunately, you can't implement the same functionality on iOS.不幸的是,您无法在 iOS 上实现相同的功能。 Android is much more flexible on how the notifications can be handled by the developer but for iOS, only internal apps developed by Apple (and those who have special permissions to call internal API's) can do what you're attempting. Android 在开发人员如何处理通知方面更加灵活,但对于 iOS,只有 Apple 开发的内部应用程序(以及那些具有调用内部 API 的特殊权限的应用程序)可以执行您正在尝试的操作。


Edit: What you can try, is to work around this limitation by creating a Today widget as suggested by SushiHangover a couple of years ago.编辑:您可以尝试的是,按照几年前SushiHangover 的建议,通过创建 Today 小部件来解决此限制。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM