Post

Replies

Boosts

Views

Activity

Reply to A voice shortcut which Added to Siri can not be removed in particular case in iOS 15 beta 3
Seems solve issue for me. This is my answer. First, write method below which can get VoiceShortcut object with UserActivity's Identifier if any. private func getShortcut(id: String, completion: ((INVoiceShortcut?) -> Void)?) {   INVoiceShortcutCenter.shared.getAllVoiceShortcuts { (shortcuts, error) in        let result = shortcuts?.filter { $0.shortcut.userActivity?.persistentIdentifier == id }.first        completion?(result)     } } Next, we should call present(editVoiceShortcutViewController) but not present(addVoiceShortcutViewController) in func present(_ addVoiceShortcutViewController: INUIAddVoiceShortcutViewController, for addVoiceShortcutButton: INUIAddVoiceShortcutButton). We need VoiceShortcut object to instantiate INUIEditVoiceShortcutViewController. So we need to wait until the shortcut's generated by system. In my code, delayed 300 milli sec, I don't think this is the best way to solve the issue. func present(_ addVoiceShortcutViewController: INUIAddVoiceShortcutViewController,          for addVoiceShortcutButton: INUIAddVoiceShortcutButton) {     addVoiceShortcutViewController.delegate = self     // do not call this !!! // present(addVoiceShortcutViewController, animated: true)     let id = addVoiceShortcutButton.shortcut!.userActivity!.persistentIdentifier!     DispatchQueue.main.asyncAfter(deadline: .now() + .milliseconds(300)) {        self.getShortcut(id: id) { sc in          if let sc = sc {            DispatchQueue.main.async {              let vc = INUIEditVoiceShortcutViewController(voiceShortcut: sc)              self.present(vc, for: addVoiceShortcutButton)            }        } else {            fatalError()        }     } } Remember this code is for iOS 15. If you support iOS 14, just call previous present(addVoiceShortcutViewController). I still don't figure out this is the best solution and need to keep watching another iOS beta version.
Jul ’21
Reply to iOS16 change orientaion
Apple released new API which is replaced with setValue:forKey:"orientation". And it's quite easy to use. iOS apps can now request rotation using [UIWindowScene requestGeometryUpdate:errorHandler:] and providing a UIWindowSceneGeometryPreferencesIOS object containing the desired orientations. (95229615) https://developer.apple.com/documentation/uikit/uiwindowscene/3975944-requestgeometryupdate/ https://developer.apple.com/documentation/ios-ipados-release-notes/ios-ipados-16-release-notes
Jun ’22
Reply to Interface Orientation doesn't work for LockedCameraCapture extension.
I enquired Apple the issue via Code-Level Support but they didn't answer, they just asked me to post to Developer Forums. But I've already done that. It seems that Locked Camera Capture Extension doesn’t support interface orientation flexibility. I understand now the specification to prevent complex since it’s a Lock Screen feature. So, we should consider simple spec for our extension.
Oct ’24