ios - 删除应用程序并重新安装后,角标(Badge)计数会保留

标签 ios objective-c cocoa-touch

我的应用程序中有一个通知部分,通知的总和以角标(Badge)计数的形式显示在应用程序图标上。当用户访问通知时,角标(Badge)计数会减少。 假设用户现在卸载构建并重新安装,即使用户没有打开应用程序,角标(Badge)计数也会直接显示在应用程序图标上。此显示的角标(Badge)计数与应用程序卸载时的相同。一旦用户打开应用程序并访问通知部分,实际上应该显示角标(Badge)计数。

最佳答案

几天前,当我从 testFlight 测试应用程序时,我遇到了同样的问题。

通常,当您删除应用程序(当它显示一些角标(Badge)编号),然后再次重新安装时,可能会出现此问题。但很难说实际问题出在哪里。

读什么Apple's official documentation is saying.

Resetting the Push Notifications Permissions Alert on iOS The first time a push-enabled app registers for push notifications, iOS asks the user if they wish to receive notifications for that app. Once the user has responded to this alert it is not presented again unless the device is restored or the app has been uninstalled for at least a day.

If you want to simulate a first-time run of your app, you can leave the app uninstalled for a day. You can achieve the latter without actually waiting a day by setting the system clock forward a day or more, turning the device off completely, then turning the device back on.

根据我的经验,有一些建议:

  • 关闭您的通知表单设置
  • 并在服务器端设置角标(Badge) 0,然后从您的设备中删除并重新安装您的应用程序。 - 安装结束后运行app
  • 运行应用程序后,从设备中删除您的应用程序,然后在服务器 1 和打开您的通知表单设置重置角标(Badge)。

不确定,但可能这对您有用。 :)

关于ios - 删除应用程序并重新安装后,角标(Badge)计数会保留,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23365024/

相关文章:

ios - 如何在 AVPlayer IOS 中使用 URL 播放 youtube 视频?

iOS 获取两个字符串之间的字符串

objective-c - 从 NSMutableArray 填充 UITableView

ios - 使用 UIImagePickerController 从照片库中访问相机

ios - 使用保存在 NSUserDefaults 中的颜色设置 View 的背景

objective-c - 推送到上一个 View ios 的后退按钮

ios - 无法使用 Alamofire 上传图像

objective-c - 如何在使用 Grand Central Dispatch 处理某些内容时以模态方式正确显示 "progress"工作表?

ios - 如何居中 subview

ios - 无法使用 String 类型的索引为 [String : AnyObject]? 类型的值下标