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

113 Posts
Sort by:
Post not yet marked as solved
1 Replies
759 Views
I have a text based action for iPhone and Mac Catalyst I am developing in Xcode 14.3.1 on macOS 13.4.1. I have the container app, an action and an AppGroup defined. I have confirmed that I can read the necessary shared defaults when the action launches. At this point the UI for the action is a simple textview in which I hope to display a modified version of the text passed to the action in the NSExtensionItems. I am not using a simulator. I am running the action directly using Xcode. What is happening is that the ActionViewController viewDidLoad runs but no visible window opens. In the console I see this as the action launches: 2023-07-05 18:27:23.692277-0700 XYZ[4634:279295] [ViewBridge] ViewBridge attempted to look up a hosted window with identifier 8E816BD5-67D3-402D-ADEB-AC59EDFA1F3B, but it was never registered. 2023-07-05 18:27:23.692408-0700 XYZ[4634:279295] [WindowHosting] UIScene property of UINSSceneViewController was accessed before it was set. .... The last line above is repeated 12 times.... Any helpful ideas would be deeply appreciated! Steve
Posted
by SwampDog.
Last updated
.
Post marked as solved
3 Replies
362 Views
I wanted to post this here in the hope that this will draw attention to what I think is a serious change in behavior that could negatively affect Catalyst apps in macOS 14.4. Prior to macOS 14.4, when the completion handler was invoked from calling dismiss() to dismiss a presented view controller in a Catalyst app, the dismissed controller no longer appeared in the chain. That is to say that if the root view controller presents View Controller A, when View Controller A is dismissed, the root view controller's presentedViewController property is nil when the completion handler for dismiss() is called. With macOS 14.4, this is no longer the case. If the root view controller presents View Controller A and then View Controller A is dismissed, the presentedViewController property of the root view controller still refers to Controller A when dismiss()'s completion handler is called. The side effect of this change in behavior means that if you try to present another view controller from the completion handler of the one being dismissed, it will fail to show because the top most view controller in the chain is the controller being dismissed and presenting from it will result in nothing showing up because it is removed from the chain immediately after the completion handler is invoked. Before macOS 14.4, it the top of the chain would have been the controller that presented the controller that was dismissed, which is what you actually want. This problem does not exist in the betas for iOS 17.4 or iPadOS 17.4. It appears to affect only Catalyst apps running under macOS 1.4.4. I think this change in behavior has the potential to affect a number existing Catalyst apps and it may not be obvious to the user something is going wrong. It really should be fixed before macOS 14.4 is released to the public. I've created a feedback with a sample Xcode project that demonstrates the problem (feedback number FB13622757).
Posted
by Enderlyn.
Last updated
.
Post not yet marked as solved
0 Replies
279 Views
I experience an issue with SceneKit that is driving me crazy ;( I have severe hangs when I disable Metal API Validation (which is default when you don't run from Xcode). So is there any way to force enable Metal API Validation for AppStore binary? (run MTL_DEBUG_LAYER=1 for Testflight or App Store) Hangs happen on Catalyst but also on iOS if I use lightingEnvironment...
Posted
by Gil.
Last updated
.
Post not yet marked as solved
5 Replies
923 Views
Hi, I am trying to create a hard link on MacOS(Mac Catalyst App) between files using [self linkItemAtURL:fromURL toURL:toURL error:&error]; Source Path for MacOS - /var/folders/lf/dt_4nxd945jdry2241phx0_40000gn/T/net.appname.AppName/documents/... Destination Path for MacOS - /Users/username/Library/Group Containers/group.net.appname.AppName.shared/Message/Media/... Although the same code works fine on iOS, but getting following error on MacOS Error Domain=NSCocoaErrorDomain Code=513 couldn’t be linked because you don’t have permission to access, Operation not permitted Source Path for iOS - /Users/user/Library/Developer/CoreSimulator/Devices/B4054540-345F-4D90-A3C5-DA6E6469A3FC/data/Containers/Data/Application/B4AB7D70-491C-49E5-9A3F-27E66EC3423D/tmp/documents/... Destination Path for iOS - /Users/user/Library/Developer/CoreSimulator/Devices/B4054540-345F-4D90-A3C5-DA6E6469A3FC/data/Containers/Shared/AppGroup/842B248E-CCA6-4B5C-82BD-2858EADD3A90/Message/Media/... However, interestingly if I try to copy the file, it works perfectly fine on MacOS as well. I am unable to understand if it is the permission issue, it should not work with copy as well. Does anyone have any reason/solution to this behaviour?
Posted
by ritubala.
Last updated
.
Post not yet marked as solved
1 Replies
313 Views
We have an iOS app with a web View. To develop and debug, we inspect the web view using Safari Dev Tools (Developer menu). This Works: We are able to inspect the web view when the application is run on physical devices as well as on simulated devices (iPhone and iPad). This Does NOT Work: We are not able to inspect the web view of the same app running, unmodified, on same Mac. Safari’s Developer menu says “No Inspectable Applications” against the Mac. Requesting guidance or leads on ways to inspect and debug the app under these conditions. Many thanks!
Posted
by jemauth.
Last updated
.
Post not yet marked as solved
0 Replies
357 Views
In our mac catalyst app we access AppKit api's by using MacOS bundle(plugin). when using CGDisplayCreateImage(_: CGDirectDisplayID, rect: CGRect) method the plugin crashes. Implementation: @objc func windowMoved(_ notification: NSNotification) { guard let win = self.window else { return } let displayId = CGMainDisplayID() let winRect = win.contentView?.convert(qrRect, from: self) var rect = win.convertToScreen(winRect ?? self.bounds) if let screenFrame = NSScreen.main?.visibleFrame { rect.origin.y = screenFrame.height - rect.maxY rect.origin.y += screenFrame.minY + win.titlebarHeight } guard let image = CGDisplayCreateImage( displayId, rect: rect) else { return } guard let qrString = image.detectQRCode().first else { return } // ... } Crash report in printed in console: -[RPDaemonProxy proxyCoreGraphicsWithMethodType:config:machPort:completionHandler:]: unrecognized selector sent to instance 0x600000500960 ( 0 CoreFoundation 0x00000001931deccc __exceptionPreprocess + 176 1 libobjc.A.dylib 0x0000000192cc6788 objc_exception_throw + 60 2 CoreFoundation 0x000000019329102c -[NSObject(NSObject) __retain_OA] + 0 3 CoreFoundation 0x0000000193148a80 ___forwarding___ + 976 4 CoreFoundation 0x00000001931485f0 _CF_forwarding_prep_0 + 96 5 ScreenCaptureKit 0x0000000227d9d95c SLSHWCaptureDesktopProxying + 692 6 SkyLight 0x0000000198b370a8 SLSHWCaptureDesktop + 488 7 SkyLight 0x0000000198b3b1ac SLSDisplayCreateImage + 252 8 MacPlugin 0x0000000112e0d374 $s9MacPlugin14MZMacQrScannerC11windowMovedyySo14NSNotificationCF + 1500 9 MacPlugin 0x0000000112e0d714 $s9MacPlugin14MZMacQrScannerC11windowMovedyySo14NSNotificationCFTo + 52 10 CoreFoundation 0x000000019315eb1c __CFNOTIFICATIONCENTER_IS_CALLING_OUT_TO_AN_OBSERVER__ + 148 11 CoreFoundation 0x00000001931f2db8 ___CFXRegistrationPost_block_invoke + 88 12 CoreFoundation 0x00000001931f2d00 _CFXRegistrationPost + 440 13 CoreFoundation 0x000000019312d648 _CFXNotificationPost + 768 14 Foundation 0x0000000194249434 -[NSNotificationCenter postNotificationName:object:userInfo:] + 88 15 AppKit 0x00000001969ffbfc -[NSWindow _setFrameCommon:display:fromServer:] + 2056 16 AppKit 0x0000000197475080 -[NSWindow _windowMovedToRect:dueToMoveEvent:] + 184 17 AppKit 0x0000000196ae8630 -[NSWindow _windowMoved:] + 832 18 AppKit 0x0000000196ae82a4 -[NSWindow _internalHandleAppKitDefinedEvent:] + 152 19 AppKit 0x0000000196ae8074 -[NSWindow(NSEventRouting) _reallySendEvent:isDelayedEvent:] + 528 20 AppKit 0x0000000196ae7c90 -[NSWindow(NSEventRouting) sendEvent:] + 284 21 AppKit 0x00000001971adda8 -[NSApplication(NSEventRouting) sendEvent:] + 1800 22 UIKitMacHelper 0x00000001acb964f8 -[NSApplication(UINSApplicationSwizzling) _uinsSwizzledSendEvent:] + 252 23 AppKit 0x0000000196dfb954 -[NSApplication _handleEvent:] + 60 24 AppKit 0x00000001969afd24 -[NSApplication run] + 512 25 AppKit 0x0000000196986fa4 NSApplicationMain + 880 26 AppKit 0x0000000196bd9798 +[NSWindow _savedFrameFromString:] + 0 27 UIKitMacHelper 0x00000001acb82198 UINSApplicationMain + 972 28 UIKitCore 0x00000001c2ea2924 UIApplicationMain + 148 29 MyApp-DEBUG 0x00000001049d2d04 main + 64 30 dyld 0x0000000192d020e0 start + 2360 This is working fine in all previous version but crashing in macOS beta 14.4 and 14.4.1.
Posted Last updated
.
Post not yet marked as solved
1 Replies
260 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
385 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
509 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
384 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
359 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
390 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
263 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
478 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
339 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
988 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
375 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
386 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
.