gpt4 book ai didi

ios - 从AWS SNS发送推送通知时如何自动增加角标(Badge)数量?

转载 作者:行者123 更新时间:2023-11-30 13:27:37 25 4
gpt4 key购买 nike

我正在使用 Amazon Web Services 向 IOS 应用程序发送“推送通知”。如何在 swift 2 中自动增加角标(Badge)编号?

我在 AppDelegate 中使用以下代码:

func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool {


let notificationTypes : UIUserNotificationType = [.Alert, .Badge, .Sound]
let notificationSettings : UIUserNotificationSettings = UIUserNotificationSettings(forTypes: notificationTypes, categories: nil)
UIApplication.sharedApplication().registerUserNotificationSettings(notificationSettings)
UIApplication.sharedApplication().registerForRemoteNotifications()

UIApplication.sharedApplication().applicationIconBadgeNumber = 0
return true
}

最佳答案

你不能只说“增加角标(Badge)数量”。

它的工作方式是,您必须在您显式发送的每个推送通知中告知角标(Badge)计数。

关于ios - 从AWS SNS发送推送通知时如何自动增加角标(Badge)数量?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36968092/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com