Mac Catalyst

RSS for tag

Start building a native Mac app from your current iPad app using Mac Catalyst.

Mac Catalyst Documentation

Posts under Mac Catalyst tag

109 Posts
Sort by:
Post not yet marked as solved
1 Replies
246 Views
It appears the app is sandboxed. I need to be able to access the broader file-system and pick a folder/file. Is this possible? Is it possible to invoke the app with a command-line argument? If so, how is it accessed (in code)?
Posted
by dcorbin.
Last updated
.
Post not yet marked as solved
3 Replies
1.1k Views
Hi, Inside a Mac Catalyst app, I need to display a popover starting from an NSToolbarItem contained inside the app toolbar (like the Apple Maps Mac app does, see below image). In order to do that, when I press the button I need to find the toolbar item view and use it as popover anchor. How can I find the view or frame of an NSToolbarItem on Mac Catalyst? A property that could help me is the NSToolbarItem "view" property (NSView), but that property has been marked has unavailable in Mac Catalyst. Any idea? Thank you
Posted
by DaleOne.
Last updated
.
Post not yet marked as solved
0 Replies
352 Views
Running in a Mac (Catalyst) target or Apple Silicon (designed for iPad). Just accessing the playbackStoreID from the MPMediaItem shows this error in the console: -[ITMediaItem valueForMPMediaEntityProperty:]: Unhandled MPMediaEntityProperty subscriptionStoreItemAdamID. The value returned is always “”. This works as expected on iOS and iPadOS, returning a valid playbackStoreID. import SwiftUI import MediaPlayer @main struct PSIDDemoApp: App { var body: some Scene { WindowGroup { Text("playbackStoreID demo") .task { let authResult = await MPMediaLibrary.requestAuthorization() if authResult == .authorized { if let item = MPMediaQuery.songs().items?.first { let persistentID = item.persistentID let playbackStoreID = item.playbackStoreID // <--- Here print("Item \(persistentID), \(playbackStoreID)") } } } } } } Xcode 15.1, also tested with Xcode 15.3 beta 2. MacOS Sonoma 14.3.1 FB13607631
Posted
by gbuela.
Last updated
.
Post not yet marked as solved
0 Replies
457 Views
While I'm keen on being on the latest version of macOS, I'm having trouble meeting the requirement that my app can run on a version of macOS that doesn't exist :) I'm using Xcode 15.2 (15C500b), targeting iOS 17.2. I've elected to have the App Store choose the minimum version for Catalyst. I've also tried selecting a version. ITMS-90899: Apple silicon Mac support issue - The app is not compatible with the provided minimum macOS version of 14.2. It can run on macOS 14.4 or later. Please specify an LSMinimumSystemVersion value of 14.4 or later in a new build, or select a compatible version in App Store Connect. For details, visit: ... Is there something I could be doing wrong to prompt this behaviour?
Posted
by Slif.
Last updated
.
Post not yet marked as solved
1 Replies
350 Views
I was loading a URL using SFSafariViewController in my app and also implemented the SFSafariViewControllerDelegate. I noticed that when I am running my app on iOS, I am not getting the callBack in safariViewControllerDidFinish(_:) until or unless "Done" button is pressed. But when I am running it on MacCatalyst following behaviour is noticed: default browser is launched. I get a callback in safariViewControllerDidFinish(_:) without any of my action(like pressing "Done" button). Is this the expected behaviour? I am curious to know why I am getting callback in safariViewControllerDidFinish(_:).
Posted
by VVD93.
Last updated
.
Post not yet marked as solved
0 Replies
318 Views
Running a Process executableURL path for a Catalyst target using a macOS type bundle returns the following error as output: (/Applications/Xcode-15.1.0.app/Contents/Developer/Platforms/MacOSX.platform/Developer/Library/Debugger/libViewDebuggerSupport_macCatalyst.dylib), but incompatible platform (have \'MacCatalyst\', need \'macOS\')) Is it possible to set which dylib platform is used by the macOS bundle executable file instead of using the MacCatalyst one?
Posted Last updated
.
Post not yet marked as solved
0 Replies
345 Views
Hello, I am working on an AUv3 extension project using SwiftUI in Xcode and have encountered a peculiar issue when implementing a simple alert on Mac Catalyst. The code is straightforward; it's merely an alert triggered by a button within a SwiftUI view. Here's the relevant portion of the code: import SwiftUI struct SwiftAUv3ExtensionMainView: View { var parameterTree: ObservableAUParameterGroup @State var showingAlert = false var body: some View { VStack { ParameterSlider(param: parameterTree.global.gain) Button(action: {showingAlert = true}, label: { Text("Button") }) } .alert("Alert", isPresented: $showingAlert, actions: {}, message: { Text("Message") }) } } The problem arises when this alert is displayed and subsequently closed. Upon closing the alert, the cursor turns into a spinning rainbow and the app freezes for several seconds. Additionally, Xcode's console displays the warning: -[NSWindow makeKeyWindow] called on _NSAlertPanel which returned NO from -[NSWindow canBecomeKeyWindow]. I am looking for insights or solutions to address this issue. Has anyone else experienced similar problems with SwiftUI alerts in AUv3 extension projects, especially when using Mac Catalyst? Any advice or suggestions would be greatly appreciated. Thank you.
Posted
by ststnd.
Last updated
.
Post not yet marked as solved
0 Replies
246 Views
I am trying to add a keyboard shortcut to an existing standard Menu Bar Button such as "Tile Window to Left of Screen". I've tried the different .command modifiers but could not find a way to get access to the existing ones in order to add a keyboard shortcut. Thanks for your help in advance
Posted
by FabienB76.
Last updated
.
Post not yet marked as solved
2 Replies
456 Views
Crash seems to be in a private Apple framework. There's some other reports of this floating around but no solutions so far. Any ideas? *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[WebAVPlayerLayer startRedirectingVideoToLayer:forMode:]: unrecognized selector sent to instance 0x6000037033c0' *** First throw call stack: ( 0 CoreFoundation 0x0000000187d56800 __exceptionPreprocess + 176 1 libobjc.A.dylib 0x000000018784deb4 objc_exception_throw + 60 2 CoreFoundation 0x0000000187e083bc -[NSObject(NSObject) __retain_OA] + 0 3 CoreFoundation 0x0000000187cc0a84 forwarding + 1572 4 CoreFoundation 0x0000000187cc03a0 _CF_forwarding_prep_0 + 96 5 AVKit 0x00000001bdc81f30 -[__AVPlayerLayerView startRoutingVideoToPictureInPicturePlayerLayerView] + 156 6 AVKit 0x00000001bdcf1d48 -[AVPictureInPicturePlatformAdapter(Common) _setRoutingVideoToHostedWindow:pictureInPictureViewController:source:] + 84 7 AVKit 0x00000001bdcd952c -[AVPictureInPicturePlatformAdapter startPictureInPicture] + 380 8 AVKit 0x000000022883000c -[AVPictureInPicturePlatformAdapterAccessibility startPictureInPicture] + 44 9 AVKit 0x00000001bdcddea0 -[AVPictureInPictureController startPictureInPicture] + 216 10 WebCore 0x00000001c75277c8 -[WebAVPlayerViewController startPictureInPicture] + 128 11 libdispatch.dylib 0x0000000102c64f14 _dispatch_call_block_and_release + 32
Posted
by doggkruse.
Last updated
.
Post not yet marked as solved
1 Replies
319 Views
Hello all, I'm porting my existing app to catalyst with optimized for mac option. However, I noticed the app will sometimes restore previous open windows if I previously kill it in Xcode. However, these restored windows are also just showing the app entry content instead of restoring the previous scene content. Question, is there anyway to disable this restore scene behavior? Thanks!
Posted Last updated
.
Post not yet marked as solved
1 Replies
928 Views
Okay so I'm getting this log every time I present a UIAlertController: Mac Catalyst: Presenting view controller <UIAlertController: 0x10f027000> from detached view controller <MyViewController: 0x10d104080> is not supported, and may result in incorrect safe area insets and a corrupt root presentation. Make sure <MyViewController: 0x10d104080> is in the view controller hierarchy before presenting from it. Will become a hard exception in a future release. A few points: MyViewController is not detached and the presentation shows just fine. I specifically check for this before presenting the alert controller like so: BOOL okayToPresentError = (self.isViewLoaded && self.view.window != nil); if (okayToPresentError) { [self presentErrorInAlertController:error]; } else { //Wait until view did appear. self.errorToPresentInViewDidAppear = error; } It spews out every time an error is fed back to my app and I present the alert controller (I can turn off the network connection and I show an alert controller with a "retry" button in it which will loop the error back so I can replay the error alert presentation over and over again) . Every time the alert controller is presented, I get this spewing in the console. Please don't start throwing hard exceptions because the check is faulty.
Posted Last updated
.
Post not yet marked as solved
1 Replies
347 Views
I have a button in my iOS app that opens the Settings app to my app's Notification permissions section. I use UIApplicationOpenSettingsURLString for this (or UIApplicationOpenNotificationSettingsURLString on iOS 15.4 and later). On Catalyst, both of these simply open the settings screen that is auto-generated from the Settings bundle. How do I get it to open to the appropriate place in System Settings?
Posted Last updated
.
Post not yet marked as solved
1 Replies
371 Views
List items do not appear to be moveable when they are contained within a popover on Mac Catalyst running on macOS Sonoma. Dragging and dropping a list item simply returns it to its original location, and onMove(preform:) is not called. The same happens using the drag handles with an EditButton() or .environment(\.editMode, .constant(.active)). Below is a reproducible sample which, to my knowledge, worked as expected on Ventura. It also currently works as expected on iPad. Changing the popover to a sheet makes it work on Mac Catalyst, but then, the view takes up a lot of unnecessary space. Does anyone have any good workarounds for this issue? struct ContentView: View { @State private var isShowingPopover = false @State private var items = ["one", "two", "three"] var body: some View { Button("Show Popover") { isShowingPopover = true } .popover(isPresented: $isShowingPopover) { List { ForEach(items, id: \.self) { item in Text(item) } .onMove { fromOffsets, toOffset in items.move(fromOffsets: fromOffsets, toOffset: toOffset) } } .frame(minWidth: 300, minHeight: 270) } } }
Posted
by caleb_ras.
Last updated
.
Post not yet marked as solved
0 Replies
287 Views
With Mac Catalyst, in Big Sur and Monterey, you could use UICommandTagShare as the property list for a UICommand in combination with activityItemsConfiguration and itemProvidersForActivityItemsConfiguration to allow a "Share" submenu to appear in a menu in your app (for instance, under the File menu like many other apps). Starting in Ventura, this submenu no longer appears with that same code, and instead the UICommandTagShare command in the menu now just displays "Share" with no submenu, which triggers a UIActivityViewController to appear in the main window. Is there any way to still allow a Share submenu to work in Ventura and beyond with Mac Catalyst? Thanks so much for any help!
Posted
by Triglyph.
Last updated
.
Post marked as solved
2 Replies
612 Views
Is there a way to link a prebuilt dylib that was built for the 'macOS' platform on Mac Catalyst without being warned by Xcode? Generally it would be better to just recompile for Mac Catalyst but this is a third party library and they have a complicated build system with dozens of dependencies that doesn't support Mac Catalyst as of now (although they have iOS and Mac 'regular'). So I would have to spend quite a bit of time trying to sort through their build system to make a Catalyst version myself. The library uses no platform specific UI code and I'm fairly certain that macOS build would work just fine on Mac Catalyst without any changes since it isn't UI related at all. It seems to work fine (apart from Xcode warning me about linking a .dylib built for macOS on Mac Catalyst). I could shim all this away in a NSBundle that is aware of the AppKit world but then I have to make all method calls to the third party framework on Mac Catalyst through the bundle and it would separate my iOS and Catalyst code relying on the same implementation which isn't great. Is there a way I could just replace the 'macOS' platform in the .dylib with macCatalyst to get rid of the warning?
Posted Last updated
.
Post not yet marked as solved
2 Replies
452 Views
Hello, is there a recommended way to render Menu items, e.g in a SwiftUI ContextMenu with icon (SFSymbols)? Let's say I have the following setup: Both buttons render fine on native macOS (e.g Sonoma) but Catalyst refuses to render the symbol at all. I tried every possible combination I could think off. The only way I found was to directly copy and paste a symbol from the SF symbols app and inline it with the label string as unicode. Unfortunately I have a couple custom SF symbols so this isn't really an option for me. I feel like this is a perfectly valid usecase, as it makes the menu visually a lot easier scannable. With UIKit and Ventura this at least worked for Menubar items but now also seems broken on Sonoma. I would greatly appreciate any hints. Thanks!
Posted Last updated
.
Post not yet marked as solved
1 Replies
461 Views
Can not select anything within WkWebView editor view of my MacCatalyst app when running on macOS 14 Sonoma. Any selection gesture or command key fails to select anything in content editable WKWebView, so none of the Editor tools can be activated. My application uses the nnhubbard / ZSSRichTextEditor WKWebView-based Rich Text Editor: https://github.com/nnhubbard/ZSSRichTextEditor. The app is built with Xcode 15.0 or 15.0.1. The app is a Catalyst app that implements an editor view with a ZSSRichTextEditor WKWebView. The problem does not occur if the the app is run in iOS or macOS 11, 12, or 13 (Catalina, Monterey, or Ventura.) The issue only occurs in macOS 14 Sonoma.
Posted Last updated
.
Post not yet marked as solved
2 Replies
1.2k Views
DemoCode: import SwiftUI import UIKit import PencilKit class PencilKitViewController: UIViewController, PKCanvasViewDelegate, PKToolPickerObserver {       lazy var canvasView: PKCanvasView = {     let canvasView = PKCanvasView()      canvasView.drawingPolicy = .anyInput      canvasView.translatesAutoresizingMaskIntoConstraints = false      return canvasView    }()       lazy var toolPicker: PKToolPicker = {     let toolPicker = PKToolPicker()     toolPicker.showsDrawingPolicyControls = true     toolPicker.addObserver(self)     return toolPicker   }()       let drawing = PKDrawing()       override func viewDidLoad() {     super.viewDidLoad()     canvasView.drawing = drawing     canvasView.delegate = self     view.addSubview(canvasView)   }       override func viewDidLayoutSubviews() {     super.viewDidLayoutSubviews()     canvasView.frame = view.bounds   }       override func viewDidAppear(_ animated: Bool) {     super.viewDidAppear(animated)     toolPicker.setVisible(true, forFirstResponder: canvasView)     toolPicker.addObserver(canvasView)     canvasView.becomeFirstResponder()   }       // canvas   func canvasViewDrawingDidChange(_ canvasView: PKCanvasView) {     print("drawing")   }       func canvasViewDidFinishRendering(_ canvasView: PKCanvasView) {         }       func canvasViewDidEndUsingTool(_ canvasView: PKCanvasView) {         }       func canvasViewDidBeginUsingTool(_ canvasView: PKCanvasView) {         } } // UIRepresentable for SwiftUI struct PencilKitView: UIViewControllerRepresentable {       class Coordinator {     var parentObserver: NSKeyValueObservation?   }       var onSubmit: ((UIImage?, Error?) -> Void)? = .none       func makeUIViewController(context: Context) -> PencilKitViewController {     let pencilKitViewController = PencilKitViewController()     context.coordinator.parentObserver = pencilKitViewController.observe(\.parent, changeHandler: { vc, _ in      })     return pencilKitViewController   }       func updateUIViewController(_ uiViewController: PencilKitViewController, context: Context) {   }       func makeCoordinator() -> Self.Coordinator { Coordinator() } } struct ContentView: View {       var onSubmit: ((UIImage?, Error?) -> Void)? = .none       var body: some View {       PencilKitView()   } } struct ContentView_Previews: PreviewProvider {   static var previews: some View {     ContentView()   } } iOS: macCatalyst:
Posted Last updated
.
Post not yet marked as solved
9 Replies
1.3k Views
I have a multiple window Mac Catalyst app. I'm using a NSToolbar and the menu bar via UIMenuBuilder. I noticed after changing windows the menu bar isn't always validating properly. For example my app implements "Undo" and "redo". So I can reproduce the issue using these steps: Perform an action that can be undone. Open a new window. This new window has its own undo manager. In the Menu bar select Edit -> Undo Undo validates even though the current window has nothing on its local undo stack. If invoked undo is performed on the inactive window which definitely seems wrong. The same thing sometimes happens in reverse (that is, undo doesn't validate when it should after switching windows). This also happens with other actions after switching windows. Sometimes I can get the actions to validate by hitting the Tab key to move focus then shift tabbing back, which seems to force proper lookup in the responder chain (but sometimes that doesn't work). It seems that Catalyst is losing track of the real active window/window scene for some reason and is validating actions on the wrong window scene. Anyone experience this and know where I could be going wrong and/or know of a possible workaround? I tried subclassing UIApplication and implementing the methods there (and then forwarding them to the active UIWindowScene). However this doesn't work, the wrong window scene has its activationState set to UISceneActivationStateForegroundActive when the problem occurs.
Posted Last updated
.