通过推送重置应用程序图标上的徽章
Reset badge on app icon from push
我使用解析向 iOS 和 Android 用户发送推送。由于某种原因,在 Parse 界面更新后,默认设置 "Increment the app badge?" 已启用,所有 iOS 用户现在都看到带有“1”的红色徽章。
在我当前的应用程序版本中。我的应用程序中没有任何删除徽章的代码。
我如何为我的用户重置此徽章?也许我可以发送一些推送来将它的数字设置为 0?
func applicationDidBecomeActive(application: UIApplication) {
let inst = PFInstallation.currentInstallation()
if inst.badge != 0{
inst.badge = 0
inst.saveEventually()
}
}
如果您想在不更新应用程序的情况下执行此操作,您可以通过 Parse 网站发送推送并设置 badge : 0
。
您应该点击 JSON
而不是选择 text
类似的东西:
For each notification, compose a JSON dictionary object (as defined by
RFC 4627). This dictionary must contain another dictionary identified
by the key aps. The aps dictionary can contain one or more properties
that specify the following user notification types:
An alert message to display to the user
A number to badge the app icon with
A sound to play
你也可以使用"content-available" : 1
创建一个静默的推送通知,用户将收到推送但不会通知,所以你可以发送这个推送来删除徽章
我使用解析向 iOS 和 Android 用户发送推送。由于某种原因,在 Parse 界面更新后,默认设置 "Increment the app badge?" 已启用,所有 iOS 用户现在都看到带有“1”的红色徽章。
在我当前的应用程序版本中。我的应用程序中没有任何删除徽章的代码。 我如何为我的用户重置此徽章?也许我可以发送一些推送来将它的数字设置为 0?
func applicationDidBecomeActive(application: UIApplication) {
let inst = PFInstallation.currentInstallation()
if inst.badge != 0{
inst.badge = 0
inst.saveEventually()
}
}
如果您想在不更新应用程序的情况下执行此操作,您可以通过 Parse 网站发送推送并设置 badge : 0
。
您应该点击 JSON
text
类似的东西:
For each notification, compose a JSON dictionary object (as defined by RFC 4627). This dictionary must contain another dictionary identified by the key aps. The aps dictionary can contain one or more properties that specify the following user notification types:
An alert message to display to the user A number to badge the app icon with A sound to play
你也可以使用"content-available" : 1
创建一个静默的推送通知,用户将收到推送但不会通知,所以你可以发送这个推送来删除徽章