gpt4 book ai didi

ios - 角标(Badge)号码不会清除

转载 作者:行者123 更新时间:2023-11-29 03:06:25 24 4
gpt4 key购买 nike

我不确定我在应用程序中更改了什么,但我无法再清除角标(Badge)编号。

我把代码写成下面的代码:

[[UIApplication sharedApplication] setApplicationIconBadgeNumber:0];

在:

 - (BOOL)application:(UIApplication *)application
didFinishLaunchingWithOptions:(NSDictionary *)launchOptions

我也尝试过:

application.applicationIconBadgeNumber = 0;

现在不行了,虽然以前可以,请指教

完整代码:

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
// Override point for customization after application launch.
[[UINavigationBar appearance] setTintColor:[UIColor blackColor]];

//Let the device know we want to receive push notifications
[[UIApplication sharedApplication] registerForRemoteNotificationTypes:
(UIRemoteNotificationTypeAlert | UIRemoteNotificationTypeSound | UIRemoteNotificationTypeBadge)];

NSLog(@"didFinishLaunchingWithOptions");

//application.applicationIconBadgeNumber = 0;
//[[UIApplication sharedApplication] setApplicationIconBadgeNumber:-1];
[[UIApplication sharedApplication] setApplicationIconBadgeNumber:0];

return YES;
}

最佳答案

您在 didFinishLaunchingWithOptions 中调用它,这样它只会在启动应用程序时被清除。

您是否尝试过从多任务菜单中关闭应用程序并再次启动它?

也尝试在 applicationDidBecomeActive 中移动 setApplicationIconBadgeNumber

关于ios - 角标(Badge)号码不会清除,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22718476/

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