Post

Replies

Boosts

Views

Activity

Reply to Open UIViewController when QR Code is scanned
Sorry. My application supports Universal Links already. In case the application is running on the background and I scan a QR Code then application is executed and shows the proper window like here: See scene code here: func scene(_ scene: UIScene, continue userActivity: NSUserActivity) { debugPrint("scenes: continue userActivity: \(userActivity)") guard userActivity.activityType == NSUserActivityTypeBrowsingWeb else { debugPrint("Different type then expected") return } // Confirm that the NSUserActivity object contains a valid NDEF message. let ndefMessage = userActivity.ndefMessagePayload if ndefMessage.records.count == 1 && ndefMessage.records[0].typeNameFormat == .empty { debugPrint("scene continue userActivity from Camera: \(userActivity.webpageURL!)") guard let navigationController = window?.rootViewController as? UINavigationController else { return } navigationController.popToRootViewController(animated: true) let donatorViewController = navigationController.topViewController as? DonatorViewController donatorViewController?.checkCameraURL(cameraURL: userActivity.webpageURL!) } else if ndefMessage.records.count > 0 && ndefMessage.records[0].typeNameFormat != .empty { debugPrint("scenes: continue userActivity from NFC Chip: \(userActivity.webpageURL!)") // Confirm that the NSUserActivity object contains a valid NDEF message. let ndefMessage = userActivity.ndefMessagePayload // Send the message to `MessagesTableViewController` for processing. guard let navigationController = window?.rootViewController as? UINavigationController else { return } navigationController.popToRootViewController(animated: true) let donatorViewController = navigationController.topViewController as? DonatorViewController donatorViewController?.addMessage(msgFromUserActivity: ndefMessage) } return } But the question is: The application is installed and not running even in background. I will scan QR code. The application is opened but the code func scene userActivity is not called. Thanks.
1w