我正在使用Amazon Web Services将“推送通知”发送到IOS应用程序。如何在swift 2中自动增加徽章编号?
我在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
}
答案 0 :(得分:0)
你不能只说'#34;增加徽章数"。
它的工作方式是您必须告知您明确发送的每个推送通知中的徽章计数。