邀请被拒绝后,应用程序徽章图标仍显示

时间:2019-03-04 21:26:21

标签: swift game-center gamekit

在我基于Game Center的回合制游戏中,我当前遇到有关应用程序图标徽章计数的问题。当我拒绝参加游戏的邀请时,徽章计数仍显示1条通知。

我什至尝试使用extension String { /// Generates a `UIImage` instance from this string using a specified /// attributes and size. /// /// - Parameters: /// - attributes: to draw this string with. Default is `nil`. /// - size: of the image to return. /// - Returns: a `UIImage` instance from this string using a specified /// attributes and size, or `nil` if the operation fails. func image(withAttributes attributes: [NSAttributedString.Key: Any]? = nil, size: CGSize? = nil) -> UIImage? { let size = size ?? (self as NSString).size(withAttributes: attributes) UIGraphicsBeginImageContext(size) (self as NSString).draw(in: CGRect(origin: .zero, size: size), withAttributes: attributes) let image = UIGraphicsGetImageFromCurrentImageContext() UIGraphicsEndImageContext() return image } } 来工作,直到重新启动游戏并加载游戏比赛为止。

即使没有匹配项,图标也会显示为1。仅在开始新比赛时才将其删除。

0 个答案:

没有答案