Post

Replies

Boosts

Views

Activity

How can I check applicationState by tap anps push cards?
when I implementation the UNUserNotificationCenterDelegate func userNotificationCenter(_ center: UNUserNotificationCenter, didReceive response: UNNotificationResponse, withCompletionHandler completionHandler: @escaping () -> Void) { var status = "" if (UIApplication.shared.applicationState == .active) { status = "active" } else if (UIApplication.shared.applicationState == .background) { status = "background" } else if (UIApplication.shared.applicationState == .inactive) { status = "inactive" } completionHandler() } I find that UIApplication.shared.applicationState == .background this case can not execute when application is in background。 why applicationState is inactive not background?
1
0
126
Mar ’25
iOS18.0 UIGraphicsImageRenderer Draw pictures to darken
func asImage() -> UIImage { let renderer = UIGraphicsImageRenderer(bounds: bounds) return renderer.image { rendererContext in layer.render(in: rendererContext.cgContext) } } This code runing on xcode15.4 with ios18.0 of 14pro device. The results are bleak compared to the original display. for ios12-ios17 all system is right.
1
1
466
Jul ’24