Posts

Post not yet marked as solved
0 Replies
397 Views
How can I insert a UISearchBar in the middle of the shortcuts bar displayed above the keyboard on iPad? You insert custom shortcuts in the shortcuts bar using 'someTextField.inputAssistantItem' with 'leadingBarButtonGroups' or 'trailingBarButtonGroups' properties, but it has no 'middleBarButtonGroups'. If I add the search bar as 'inputAccessoryView', like 'someTextField.inputAccessoryView = UISearchBar()' it is added above the shortcuts bar.
Posted Last updated
.
Post not yet marked as solved
0 Replies
385 Views
Got some crashes in Xcode Organizer from a macCatalyst app and they are not symbolicated. The crashes are from an X86-64 machine, and my work machine is M1. When trying to symbolicate them in Organizer I get an error: "Unable to Symbolicate Crash - An error occurred attempting to symbolicate crash. Unable to locate dSYMs for ...". It makes sense, as I only run the app on M1, and maybe the X86-64 was not built on this machine. I then went to download the dSYM file from AppStoreConnect/TestFlight/Build Metadata, but there is no "Download dSYM" link, even though the app page says "Includes Symbols Yes". I then tried to compile the app for "AnyMac (Mac Catalyst, Apple Silicon, Intel)", and now I get a binary with two images, the arm64 and the x86, but the UUID of x86 image is different than the one from the crash file. How can I get the original dSYM to symbolicate crashes from production?
Posted Last updated
.
Post not yet marked as solved
1 Replies
474 Views
I'm working on an app displaying a few hundred custom labels. The custom label is modelled after UILabel. When I implement the custom label using TextKit, the app is using about 0.5 GB of memory. When I implement it using TextKit2, it takes about 1.2 GB. Did anyone notice such a big difference in memory usage between TextKit and TextKit2? For how long will TextKit be around before being deprecated?
Posted Last updated
.
Post not yet marked as solved
1 Replies
559 Views
I have created a widget and added a button in its body like this: Button("Tap me: ", intent: TaskIntent()). If I compile the TaskIntent in both the app and the widget, when tapping the button, it open the app and that's all, 'perform' is not called at all. If I compile the TaskIntent only in the widget, when tapping the button, it does nothing, 'perform' is not called either. Is there any special sauce needed to run the 'perform' of the AppIntent attach to the button?
Posted Last updated
.
Post marked as solved
3 Replies
1.2k Views
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?
Posted Last updated
.
Post not yet marked as solved
1 Replies
586 Views
I have a doc app consisting of two types of scenes, "Default Configuration" and "About". When an about scene is created, I set its activation condition to NO, so it does not get activated for any userActivity or URLContext: scene?.activationConditions.canActivateForTargetContentIdentifierPredicate = NSPredicate(value: false) Now, I open an about scene and some default configuration scenes. If the about scene is on top, then when opening a handoff user activity, this about scene gets activated instead of the default ones, or a new default scene being created. If the about scene is in background or it is not created, a correct default scene is activated and passed the activity. Opening documents from finder works fine in both cases, a default scene is activated and it gets URLContext objects. Is this the expected behaviour? I found a workaround but it feels like a workaround. I enable activation on the about scene: scene?.activationConditions.canActivateForTargetContentIdentifierPredicate = NSPredicate(value: false) Then in the about scene, I listen to scene(_:userActivity:), get the activity when it gets activated, pass it to UIApplication.shared.delegate, which in turn requests a new scene activation and passes the activity object to this new scene. In this case, a scene with the correct default configuration gets activated. I'm running the tests on macOS 12.4 if it matters.
Posted Last updated
.
Post marked as solved
1 Replies
709 Views
I want to create an Welcome window for my app to show it at the first launch. While this window is visible, no other window/scene should be created. The user should click a "Continue" button to be able to use the app, and create new scenes. I defined two scenes, "Default Configuration" and "Welcome", and at the end of "application(_ :willFinishLaunchingWithOptions:)" I display the Welcome scene. It works ok, but a default scene is also created at startup while the Welcome window/scene is visible. I also tried using a macOS plugin. I defined the Welcome window in a xib in the plugin, and launched it from there. I did set "Visible at Launch", but that did not prevent a second scene to be created at startup, with the "Default Configuration". How can I temporarily prevent new scenes to be created?
Posted Last updated
.
Post marked as solved
1 Replies
752 Views
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'.
Posted Last updated
.
Post not yet marked as solved
0 Replies
966 Views
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?
Posted Last updated
.
Post not yet marked as solved
0 Replies
712 Views
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?
Posted Last updated
.
Post not yet marked as solved
5 Replies
1.8k Views
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?
Posted Last updated
.