Post

Replies

Boosts

Views

Activity

Reply to How to create different scenes with different views by code?
@main struct mindoApp: App { 		@UIApplicationDelegateAdaptor private var appDelegate: AppDelegate 		var body: some Scene { 						 WindowGroup { 											 ContentView() 						 } 		 } } class AppDelegate: NSObject, UIApplicationDelegate { 		func application(_ application: UIApplication, configurationForConnecting connectingSceneSession: UISceneSession, options: UIScene.ConnectionOptions) -> UISceneConfiguration { 				if options.userActivities.first?.activityType == "newWindow" { 					 let configuration = UISceneConfiguration(name: "Default Configuration", sessionRole: connectingSceneSession.role) 					 configuration.delegateClass = SceneDelegate.self 					 return configuration 				} else { 					 return UISceneConfiguration(name: "Default Configuration", sessionRole: connectingSceneSession.role) 			 } } class SceneDelegate: UIResponder, UIWindowSceneDelegate { 		var window: UIWindow? 		func scene(_ scene: UIScene, willConnectTo session: UISceneSession, options connectionOptions: UIScene.ConnectionOptions) { 				if let windowScene = scene as? UIWindowScene { 						let window = UIWindow(windowScene: windowScene) 						window.rootViewController = UIHostingController(rootView: TestView()) 						self.window = window 						window.makeKeyAndVisible() 				} 		} } The following code is used to create a new scene/window 				UIApplication.shared.requestSceneSessionActivation(nil, userActivity: NSUserActivity(activityType: “newWindow"), options: nil, errorHandler: nil) The TestView can be put into the second scene/window on iPadOS/macOS. But, the App crashes when closing the second scene/window: Fatal error: Attempted to read an unowned reference but object 0x60000061d1c0 was already deallocated
Aug ’20
Reply to iOS 15 beta 4 CloudKit Auth Error
CoreData: CloudKit: CoreData+CloudKit: -[NSCloudKitMirroringDelegate _scheduleAutomatedImportWithLabel:activity:completionHandler:]_block_invoke(2775): <NSCloudKitMirroringDelegate: 0x28326c0c0> - Finished automatic import - SandboxImport - with result: <NSCloudKitMirroringResult: 0x280722dc0> success: 0 madeChanges: 0 error: Error Domain=NSCocoaErrorDomain Code=134410 "(null)" UserInfo={NSUnderlyingError=0x280987db0 {Error Domain=CKErrorDomain Code=36 "CKInternalErrorDomain: 1028" UserInfo={NSUnderlyingError=0x2809a7900 {Error Domain=CKInternalErrorDomain Code=1028 "Account temporarily unavailable due to bad or missing auth token" UserInfo={CKErrorDescription=Account temporarily unavailable due to bad or missing auth token, NSLocalizedDescription=Account temporarily unavailable due to bad or missing auth token, NSUnderlyingError=0x2809a69d0 {Error Domain=CKInternalErrorDomain Code=2011 "Couldn't get an authentication token" UserInfo=0x2812a2200 (not displayed)}}}, CKErrorDescription=Account temporarily unavailable due to bad or missing auth token, NSDebugDescription=CKInternalErrorDomain: 1028, NSLocalizedDescription=Account temporarily unavailable due to bad or missing auth token}}}
Jul ’21