From fa3b5defd8fd8c0150ded3c65b4d5985e0b12cb3 Mon Sep 17 00:00:00 2001 From: Undefined Date: Sat, 13 Sep 2025 15:02:10 +0000 Subject: [PATCH 1/2] Fix: app freeze or crash when click close button --- PlayTools/PlayCover.swift | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/PlayTools/PlayCover.swift b/PlayTools/PlayCover.swift index a45a24ab..5794e0b5 100644 --- a/PlayTools/PlayCover.swift +++ b/PlayTools/PlayCover.swift @@ -59,9 +59,17 @@ public class PlayCover: NSObject { // There is an expiration handler, but idk how to invoke it. Skip for now. // Step 3: Terminate + for scene in UIApplication.shared.connectedScenes { + scene.delegate?.sceneDidDisconnect?(scene) + NotificationCenter.default.post(name: UIScene.didDisconnectNotification, + object: scene) + } UIApplication.shared.delegate?.applicationWillTerminate?(UIApplication.shared) - NotificationCenter.default.post(name: UIApplication.willTerminateNotification, - object: UIApplication.shared) + // Some apps will freeze or crash when click close button if we send willTerminateNotification. + // The developer documentation says this is a "may be called method", so it can be safely skipped. + // https://developer.apple.com/documentation/uikit/uiapplicationdelegate/1623111-applicationwillterminate +// NotificationCenter.default.post(name: UIApplication.willTerminateNotification, +// object: UIApplication.shared) DispatchQueue.main.async(execute: AKInterface.shared!.terminateApplication) // Step 3.5: End BGTask From 65caa2129b401d97bf1af02b11b903db9a5f9343 Mon Sep 17 00:00:00 2001 From: Undefined Date: Fri, 10 Oct 2025 13:10:01 +0000 Subject: [PATCH 2/2] disable SwiftLint line_length for url --- PlayTools/PlayCover.swift | 1 + 1 file changed, 1 insertion(+) diff --git a/PlayTools/PlayCover.swift b/PlayTools/PlayCover.swift index 5794e0b5..e0f7fa97 100644 --- a/PlayTools/PlayCover.swift +++ b/PlayTools/PlayCover.swift @@ -68,6 +68,7 @@ public class PlayCover: NSObject { // Some apps will freeze or crash when click close button if we send willTerminateNotification. // The developer documentation says this is a "may be called method", so it can be safely skipped. // https://developer.apple.com/documentation/uikit/uiapplicationdelegate/1623111-applicationwillterminate + // swiftlint:disable:previous line_length // NotificationCenter.default.post(name: UIApplication.willTerminateNotification, // object: UIApplication.shared) DispatchQueue.main.async(execute: AKInterface.shared!.terminateApplication)