UILocalNotification未显示在锁定屏幕中 [英] UILocalNotification not showing in the lock screen

查看:97
本文介绍了UILocalNotification未显示在锁定屏幕中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

UILocalNotification是否必须具有任何特殊参数才能在锁定屏幕上显示Facebook Messenger消息?我的通知确实出现在通知下的通知中心。我认为这种行为类似于AppStore通知,它们只显示为通知,但用户从不收到警报。

Is there any special parameters an UILocalNotification has to have in order to show on the lock screen like the Facebook Messenger messages? My notification does appear on the notification center under "notifications". I think the behaviour is similar to the AppStore notifications in where they are only shown as a notification but the user is never alerted.

推荐答案

你必须获得许可才能在锁定屏幕上显示通知!一看Appdelegate.m中的代码

You have to take permission for show the notification on lock screen ! once look at the code in Appdelegate.m

func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool {
// Override point for customization after application launch.
let notificationCategory = UIMutableUserNotificationCategory()
let categories = Set<UIUserNotificationCategory>(arrayLiteral: notificationCategory)
let settings = UIUserNotificationSettings(forTypes: [.Alert, .Badge, .Sound], categories: categories)
application.registerUserNotificationSettings(settings)
return true 
}

这篇关于UILocalNotification未显示在锁定屏幕中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆