Post not yet marked as solved
I get this error in Xcode 13.4. I set the deployment target to macOS 12.3 (latest available) but I still get this error.
Which version of macOS should I set as deployment target, to get rid of this error. I dont want to use 'if #available' because I have no alternative code path.
Which macOS version corresponds to Mac Catalyst 14.0?
Hi, I'm storing a string on a named UIPasteboard, and when reading it back, it comes as nil.
It works fine on iOS, but on MacCatalyst it always returns nil.
I store it like that:
let p = UIPasteboard(name: UIPasteboard.Name(rawValue: "aaa"), create: true)!
p.string = "some text"
print("hasStrings: \(p.hasStrings)")
// hasStrings: true
and I read it like that:
let p = UIPasteboard(name: UIPasteboard.Name(rawValue: "aaa"), create: false)!
print("hasStrings: \(p.hasStrings)")
// hasStrings: false
I'm running the two pieces of code from two different methods of a UIViewController. Say I store the string in 'viewWillAppear', and read it back in 'viewDidAppear'.
Post not yet marked as solved
I'm building a MacCatalyst app, where the Tab key is used for a special functionality within the app. For that, I inserted a UIKeyCommand in the main menu for "\t".
When I press Tab, the default functionality takes over, and the focus moves to a button in the toolbar and stays there, which I don't want. As a result, the action of my key command is not called. I set tabKeyCommand.wantsPriorityOverSystemBehavior = true, but it makes no difference.
The root view controller of my app is an UISplitViewController. I overloaded 'shouldUpdateFocus(in:)' and always return false hoping that this will disable moving the focus for the whole app, but it's not working. It looks like it's more difficult then needed.
How can I instruct the system to not interfere with the Tab key?
Post not yet marked as solved
I have a document based app, and if the user tries to open a document in the active/foreground scene, and that document is already open in another existing scene, I would like to activate that existing scene, and destroy the current foreground one.
I do it like that:
UIApplication.shared.requestSceneSessionActivation(existingSession, userActivity: activity, options: nil)
UIApplication.shared.requestSceneSessionDestruction(foregroundSession, options: nil)
When I run this code, the foreground scene is destroyed, but the activated one is not brought to foreground, it simply takes me to home screen.
On iOS14, it kinda works, the existing one is brought to foreground and splits the screen with the current foreground one for a split second, then the current one is destroyed, and the existing scene now takes all the screen. The intermediate split state is not visually nice but it does it's job. How can I achieve the same behaviour on iOS15?
Post not yet marked as solved
I have an UIButton and a UITextField. When I press the button, the text field is made the first responder.Here is the action for button press:@objc func btnAction(_ sender: Any?) { print("changeCount before pressing btn: \(UIPasteboard.general.changeCount)") txtField.becomeFirstResponder() DispatchQueue.main.asyncAfter(deadline: DispatchTime.now() + 2) { print("changeCount after showing kbd: \(UIPasteboard.general.changeCount)") }}When I press the button, the keyboard is shown and the changeCount of the general pasteboard is incremented by 2 even if I dont add anything to pasteboard!? Here's the output:...changeCount before pressing btn: 45changeCount after showing kbd: 47...On iOS 11, 12, it works as expected, the changedCount is not modified.Further on, I subclassed the UITextField like this:class CustomTextField: UITextField { override func canPerformAction(_ action: Selector, withSender sender: Any?) -> Bool { print("canPerformAction: \(action)") let a = super.canPerformAction(action, withSender: sender) print("changeCount after canPerformAction: \(UIPasteboard.general.changeCount)") return a }}The output is now:...changeCount before pressing btn: 45canPerformAction: paste:changeCount after canPerformAction: 46changeCount after showing kbd: 47...On iOS 11, 12, 'canPerformAction' is not called at all:...changeCount before pressing btn: 3003changeCount after showing kbd: 3003...It this a bug on iOS13 or am I doing something wrong?