From 6ef90f9c3fa984197428cb10aedf2fdd84f3df2b Mon Sep 17 00:00:00 2001 From: joywayer Date: Tue, 23 Jun 2026 23:07:23 +0800 Subject: [PATCH] =?UTF-8?q?SubGameDirectoryStore.keyPrefix=20=E4=B9=9F?= =?UTF-8?q?=E5=8A=A0=20nonisolated?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 之前只把 3 个 method 标 nonisolated,漏了 keyPrefix 静态常量。actor 内的 ensureReady 访问 method 时跨 actor 拿到 keyPrefix 会触发 MainActor 隔离检查 失败(SWIFT_DEFAULT_ACTOR_ISOLATION = MainActor 项目设置下,未标注则默认 MainActor)。补 nonisolated。 Co-Authored-By: Claude Opus 4.7 --- ylgamehall/Source/Resource/SubGameDirectoryStore.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ylgamehall/Source/Resource/SubGameDirectoryStore.swift b/ylgamehall/Source/Resource/SubGameDirectoryStore.swift index 3ba58a4..2dfb29f 100644 --- a/ylgamehall/Source/Resource/SubGameDirectoryStore.swift +++ b/ylgamehall/Source/Resource/SubGameDirectoryStore.swift @@ -16,7 +16,7 @@ import Foundation /// UserDefaults 线程安全,所有方法 nonisolated 让 actor / MainActor / 后台线程都能直接调用。 public enum SubGameDirectoryStore { - private static let keyPrefix = "ylgh.subGameDir." + nonisolated private static let keyPrefix = "ylgh.subGameDir." /// 当前实际目录名。已持久化 → 返回持久化值;未持久化 → 返回 directory 本身 /// (对应 msext NSUserDefaults 缺 key 时 gamefilepath = gamename 的默认)。