ソースを参照

Fix Swinject resolving from non-main thread

Sam King 1 年間 前
コミット
a3677cd298
1 ファイル変更7 行追加10 行削除
  1. 7 10
      Trio/Sources/Application/TrioApp.swift

+ 7 - 10
Trio/Sources/Application/TrioApp.swift

@@ -104,7 +104,7 @@ extension Notification.Name {
             do {
                 try await coreDataStack.initializeStack()
 
-                await MainActor.run {
+                await Task { @MainActor in
                     // Only load services after successful Core Data initialization
                     loadServices()
 
@@ -114,7 +114,12 @@ extension Notification.Name {
                     self.initState.complete = true
                     Foundation.NotificationCenter.default.post(name: .initializationCompleted, object: nil)
                     UIApplication.shared.registerForRemoteNotifications()
-                }
+                    do {
+                        try await BuildDetails.shared.handleExpireDateChange()
+                    } catch {
+                        debug(.default, "Failed to handle expire date change: \(error)")
+                    }
+                }.value
             } catch {
                 debug(
                     .coreData,
@@ -127,14 +132,6 @@ extension Notification.Name {
                 }
             }
         }
-
-        Task {
-            do {
-                try await BuildDetails.shared.handleExpireDateChange()
-            } catch {
-                debug(.default, "Failed to handle expire date change: \(error)")
-            }
-        }
     }
 
     /// Attempts to initialize the CoreDataStack again after a previous failure.