簡體   English   中英

應用程序位於前台時iOS上的橫幅

[英]Banners on iOS when App is in the Foreground

我的問題是雙重的。

1)我想知道當我的應用程序在前台時我是否可以在iOS 11上使用橫幅 (也就是吐司消息),或者我的應用程序是否會因此被拒絕。 當我在談論橫幅時,我指的是如下截圖中的消息

在此輸入圖像描述

我的應用程序位於forground中時,人機界面指南尚不清楚我是否可以使用橫幅https://developer.apple.com/design/human-interface-guidelines/ios/system-capabilities/notifications/

2)Xamarin Forms不提供橫幅通知,以便第三方軟件適用於本地通知?

要在應用程序處於運行模式時顯示橫幅,您必須使用自定義。 請在iOS App中添加以下類文件。

using UserNotifications;
public class UserNotificationCenterDelegate : UNUserNotificationCenterDelegate
    {
        #region Constructors
        public UserNotificationCenterDelegate()
        {
        }
        #endregion

        #region Override Methods

        public override void WillPresentNotification(UNUserNotificationCenter center, UNNotification notification, Action<UNNotificationPresentationOptions> completionHandler)
        {
            // Do something with the notification
            Console.WriteLine("Active Notification: {0}", notification);

            // Tell system to display the notification anyway or use
            // `None` to say we have handled the display locally.
            completionHandler(UNNotificationPresentationOptions.Alert);           
        }
        #endregion
    }

當應用程序處於前台時,這將在您的app中顯示橫幅。

許多應用程序都有警報,你去吧,我的公司也有警報,它可以通過應用程序審查

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM