Ios 通知到达时,应用程序图标徽章不显示
我在iPad上有一个应用程序。当收到通知或服务器静态发送时,它不会显示应用程序上的徽章图标。我已使用徽章选项注册了通知,但徽章仍然没有出现在应用程序图标上。此外,当我选中设置->通知->我的应用程序时。它没有显示徽章的切换。仅显示警报和声音,无徽章。在这里,我在通知中附上了设置的图像 链接:[ 我的代码如下: 链接:[ 从didFinishLaunchingWithOptions调用此Ios 通知到达时,应用程序图标徽章不显示,ios,objective-c,swift,push-notification,badge,Ios,Objective C,Swift,Push Notification,Badge,我在iPad上有一个应用程序。当收到通知或服务器静态发送时,它不会显示应用程序上的徽章图标。我已使用徽章选项注册了通知,但徽章仍然没有出现在应用程序图标上。此外,当我选中设置->通知->我的应用程序时。它没有显示徽章的切换。仅显示警报和声音,无徽章。在这里,我在通知中附上了设置的图像 链接:[ 我的代码如下: 链接:[ 从didFinishLaunchingWithOptions调用此 func registerForPushNotifications() { if #available
func registerForPushNotifications() {
if #available(iOS 10.0, *) {
let center = UNUserNotificationCenter.current()
let content = UNMutableNotificationContent()
content.sound = UNNotificationSound.default
center.delegate = self
UNUserNotificationCenter.current().delegate = self
center.requestAuthorization(options: [.sound, .alert, .badge])
{ (granted, error) in
if error == nil{
DispatchQueue.main.async {
UIApplication.shared.registerForRemoteNotifications()
}
}
}
} else {
let settings = UIUserNotificationSettings(types: [.alert, .badge, .sound], categories: nil)
UIApplication.shared.registerUserNotificationSettings(settings)
UIApplication.shared.registerForRemoteNotifications()
}
}
//在应用程序委托中的Option方法上注册DidFinishLaunchingWith上的推送通知方法调用。在ipad快照下方
我可以问一下您如何使用firebase或其他工具在应用程序中执行通知吗?不使用firebase,使用UNUserNotificationOk好的,您可以参考以下内容: