如何注册通知直接为警报,而不仅仅是横幅?XCode中的Swift或Objective C



这就是我注册本地通知的方式:

 if application.respondsToSelector(#selector(UIApplication.registerUserNotificationSettings(_:))) {
            if #available(iOS 8.0, *) {
                let types:UIUserNotificationType = ([.Alert, .Sound, .Badge])
                let settings:UIUserNotificationSettings = UIUserNotificationSettings(forTypes: types, categories: categoriesForSettings as! Set<UIUserNotificationCategory>)
                application.registerUserNotificationSettings(settings)
                application.registerForRemoteNotifications()
            } else {
                application.registerForRemoteNotificationTypes([.Alert, .Sound, .Badge])
            }
}
else 
{
            // Register for Push Notifications before iOS 8
            application.registerForRemoteNotificationTypes([.Alert, .Sound, .Badge])
}

我的问题是通知以横幅的形式出现。只有在用户将应用程序的设置从Banner更改为Alert之后,通知才会作为真正的Alert出现。

我的问题是:是否可以直接询问或注册真正的警报,而不仅仅是横幅通知?

提前感谢!

可惜不能从代码中更改。

相关内容

最新更新