-2
A
回答
0
如果您已经尝试“macmoonshine”和“抢”的答案,你仍然没有得到徽章图标。
试试这个。希望能帮助到你。
目标C
UIUserNotificationSettings* notificationSettings = [UIUserNotificationSettings settingsForTypes:UIUserNotificationTypeBadge | UIUserNotificationTypeSound categories:nil];
[[UIApplication sharedApplication] registerUserNotificationSettings:notificationSettings];
[UIApplication sharedApplication].applicationIconBadgeNumber = 1;
**夫特3 **
let badgeCount: Int = 10
let application = UIApplication.sharedApplication()
application.registerUserNotificationSettings(UIUserNotificationSettings(forTypes: [.Badge, .Sound], categories: nil))
application.applicationIconBadgeNumber = badgeCount
夫特3并用UserNotifications框架
进口UserNotifications
let badgeCount: Int = 10
let application = UIApplication.shared
let center = UNUserNotificationCenter.current()
center.requestAuthorization(options:[.badge, .alert, .sound]) { (granted, error) in
// Enable or disable features based on authorization.
}
application.registerForRemoteNotifications()
application.applicationIconBadgeNumber = badgeCount
0
根据需要设定UIApplication
的applicationBadgeNumber。
0
试试这个斯威夫特3:
UIApplication.shared.applicationIconBadgeNumber = 1
相关问题
- 1. 如何永远在后台模式下运行应用程序?
- 2. WPF应用程序仍然在后台运行关闭
- 3. 应用程序不能在后台模式下运行ios
- 4. 如何让关闭ios应用程序后仍然运行
- 5. 程序在System.exit后仍然运行
- 6. 的TimerTask()仍然在后台运行,即使在应用程序退出的Android
- 7. Bash - 在后台运行程序仍然导致脚本等待
- 8. JOGL javaw.exe在应用程序关闭后仍然运行
- 9. ClickOnce应用程序在卸载后仍然运行
- 10. Java - 请问在USB弹出后应用程序仍然运行
- 11. Application.Exit() - 应用程序在关闭窗体后仍然运行
- 12. 应用程序不运行在后台模式
- 13. iPhone应用程序崩溃,而应用程序运行在后台模式
- 14. 应用程序仍在后台运行Xcode 4.2 iOS 5
- 15. 使J2ME应用程序在后台运行,而另一个应用程序仍然可以工作
- 16. 如何在隐形模式下运行qt C++控制台应用程序?
- 17. 如何在后台运行.NET控制台应用程序
- 18. 如何在后台运行控制台应用程序(无UI)?
- 19. 程序仍然在Netbeans中运行,即使在关闭应用程序之后
- 20. 在后台运行应用程序IntentService
- 21. Android应用程序在后台运行
- 22. Android,在后台运行应用程序
- 23. 在后台运行应用程序
- 24. 在后台运行应用程序
- 25. 在后台运行iOS应用程序
- 26. 在后台运行的应用程序
- 27. iphone应用程序在后台运行?
- 28. Android在后台运行应用程序
- 29. 在后台运行应用程序Cordova
- 30. 在后台运行android应用程序?
谢谢你回答我,但我想知道的是,当应用程序在后台模式,有什么办法可以让应用程序仍运行函数来获得API结果,当获得真正的价值,然后更改徽章,不使用推送通知和本地通知。 – DanielTing