Mac Catalyst

RSS for tag

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

Posts under Mac Catalyst tag

112 Posts
Sort by:

Post

Replies

Boosts

Views

Activity

Cannot build app on Catalyst after updating to Xcode 15.4 RC
We are facing an issue on Catalyst when building our app using Xcode 15.4. The issue is related to precompiled frameworks and seems to be widespread as it happens with multiple vendors (like Firebase or Braze). We are using SPM to add these dependencies, for instance: .package(url: "https://github.com/braze-inc/braze-swift-sdk", from: "8.2.1"), When building, we get the following error: clang:1:1: invalid version number in '-target arm64-apple-ios10.15-macabi' Our macOS deployment target is 12.3. Our iOS deployment target is 15.4. I will try to create a reproducer I can share but I wanted to share this in case there's a known workaround. Thanks in advance!
4
2
690
1d
os_signpost not working on macOS device, works on iOS device
I have an iOS app that uses os_signpost API for instrumentation. When I profile it from Xcode on real iOS device, it works as expected. When I profile its macCatalyst variant (using the identical code) on the same Mac where Xcode is running, the os_signpost Instrument does not show anything, not even the Apple provided signposts that are otherwise visible on the iOS. How do I make it work?
5
0
522
1d
Running a Catalyst application via XCTest loads macOS specific frameworks
When trying to test a Catalyst application with XCTest the application crashes at startup with Symbol not found error when certain frameworks are in use. This is caused by XCTest / Xcode adding /Applications/Xcode.app/Contents/SharedFrameworks to DYLD_FRAMEWORK_PATH causing dyld to load the macOS specific framework variant of for example RealityKit instead from /System/iOSSupport/System/Library/Frameworks as defined in the load commands. Which leads to symbol mismatches, for example ARView.Environment.Color is a UIColor on Mac Catalyst but an NSColor on macOS (_$s10RealityKit6ARViewC11EnvironmentV10BackgroundV5coloryAGSo7UIColorCFZ vs. _$s10RealityKit6ARViewC11EnvironmentV10BackgroundV5coloryAGSo7NSColorCFZ) Tried prepending /System/iOSSupport/System/Library/Frameworks to the DYLD_FRAMEWORK_PATH env var of the test target, but via some private frameworks still wrong framework variants were loaded. Any ideas for possible fixes or workarounds?
8
0
173
2d
Unable to load MKMapView from AppKit bundle in Catalyst app
I am trying to load an auxiliary window from an AppKit bundle that loads a NSViewController from a storyboard. This NSViewController displays a MKMapView. I want to avoid supporting multiple windows from my Catalyst app so I do not want to load this window via a SceneDelegate, and that is why I have chosen to go the AppKit bundle route. If I load a similar view controller which contains a single label, then all works as expected. However, if I try to load a view controller with the MKMapView, I get the following error after crashing: *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[MKMapView nsli_piercingToken]: unrecognized selector sent to instance 0x15410f600' DropBox link to sample app with buttons on a view to select either the "Map View" (crashing) or the "Label View" (working): https://www.dropbox.com/scl/fi/q9daurhzqvil9o2ry6k1t/CatalystMap.zip?rlkey=yjbqfn6uxfrfh1jgsdavagta7&dl=0
2
0
202
2d
Could Not Launch Mac (Designed for iPad) App in Xcode
I get the following message when I try to run this app in Xcode. Could not launch AppName. Runningboard has returned error 5. Please check the system logs for the underlying cause of the error. Interestingly, the destination Mac (Mac Catalyst) destination does launch. The funny thing is there is a companion app almost exactly like this one that launches fine. Any help with this would be greatly appreciated. Xcode helped me to file a feedback. The number is FB13206919.
8
1
1.7k
1w
App Store Mac Catalyst warning; asking for a minimum version of macOS that doesn't exist
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?
4
1
650
1w
Spelling/grammar check settings persistence in UITextView on Mac Catalyst
In our Mac Catalyst app running on macOS, the Edit > Spelling and Grammar > Check Spelling While Typing, Check Grammar With Spelling, and Correct Spelling Automatically preferences are reset with each opening of a new text view. How can we make those preferences persistent? Ie, when someone changes those settings for our app's text view, other incarnations of our app's text views should respect the latest preferences. We looked at swizzling NSTextView's toggleAutomaticSpellingCorrection:, saving those to NSUserDefaults, and then reading those preferences when we set up our UITextView subclass, and then setting the UITextInputTraits properties accordingly. However, our approach felt heavy handed, and I'm wondering if we are missing some out-of-the-box functionality that will make those preferences intuitively persistent. Does anyone have any suggestions? Thank you.
0
0
136
1w
Does setAlternateIconName work in mac Catalyst?
I'm trying to change app icon on Dock in macOS from my app. But couldn't get to work. The setAlternateIconName works fine in iOS simulator, but when I run in on my mac (Catalyst) I got this error: The requested operation couldn’t be completed because the feature is not supported. Apple Doc - https://developer.apple.com/documentation/uikit/uiapplication/2806818-setalternateiconname Thank you
1
1
743
1w
Implement preferences menu entry in MacCatalyst
I have an app which uses SwiftUI and Mac Catalyst. When running on a Mac I want to provide a preferences menu entry with the usual keyboard shortcut Command + ,. An implementation via the Settings bundle is out of question since my preferences are too complex for this. Here is a reduced example of my implementation: import SwiftUI @main struct PreferencesMenuTestApp: App { @UIApplicationDelegateAdaptor private var appDelegate: AppDelegate var body: some Scene { WindowGroup { ContentView() } } } class AppDelegate: UIResponder, UIApplicationDelegate { override func buildMenu(with builder: UIMenuBuilder) { let preferencesCommand = UIKeyCommand(title: "Preferences…", action: #selector(showPreferences), input: ",", modifierFlags: .command) // let preferencesCommand = UIAction(title: "Preferences…") { action in // debugPrint("show preferences") // } let menu = UIMenu(title: "Preferences…", options: .displayInline, children: [preferencesCommand]) builder.insertSibling(menu, afterMenu: .about) } @objc func showPreferences() { debugPrint("show preferences") } } The problem is that the menu entry is disabled. Obviously the provided selector is not recognised. When I mark the AppDelegate with @main, then the menu entry is enabled. Of course then the app's window is empty. When I switch to the UIAction implementation (the out commented code) it works fine. But since one cannot provide a keyboard shortcut for UIActions this is not a good solution. What am I missing? How would one implement a preferences menu entry that actually works?
3
0
673
2w
In Mac Catalyst, what would be the simplest way to hide the title bar but retain its double click functionality?
After adopting sidebar / split view controller support in Mac Catalyst, there are several UI side effects that make the default title bar stick out and look inconsistent. If I hide the title bar however, func scene(_ scene: UIScene, willConnectTo session: UISceneSession, options connectionOptions: UIScene.ConnectionOptions) { guard let windowScene = (scene as? UIWindowScene) else { return } #if targetEnvironment(macCatalyst) if let titlebar = windowScene.titlebar { titlebar.titleVisibility = .hidden titlebar.toolbar = nil } #endif } the ability to double click the top of the window to maximize it is lost. What would be the simplest approach to have both the hidden appearance, but keep the double click behavior?
0
0
167
2w
RTC Peer connection error when trying to accept live video call in WKWebView ran in Mac Catalyst
I am developing an WKWebView app that runs on both mobile and mac platforms using a react website. Currently, an admin user can send a call request in which the user gets a pop-up to answer. on iOS it works as intended, the user is asked to grant permission to utilize camera and microphone and the user is immediately connected upon accepting, however I never receive the pop-up when running in Mac Catalyst. I have ensured to enable permissions in sandbox settings as well as adding NSCamera and NSMic permissions in the property list. in the safari debugging console I receive this error upon clicking the accept call ReferenceError: Can't find variable: RTCPeerConnection Ive attempted to use the webview callback requestMediaCapturePermissionFor, and this did not seem to trigger on attempting to answer the call. Is this an error on my development end? or is this an issue I should look to the react code for a fix. I appreciate any feedback possible. Thanks.
0
0
166
3w
How can I put an NSToolbarItem on the leading edge of an NSToolbar in Catalyst?
I'm working to make my iOS app available via Catalyst, and I'm adding a leading-edge sidebar via UISplitViewController and putting a toggle button in the window toolbar to control it. I'd like that sidebar toggle button to go on the leading side of the toolbar, before the window title. In the Adding a Toolbar Catalyst tutorial, there are screenshots of this behavior: But when I download the finished project and run it on my machine (macOS 14.4), the toolbar buttons are clustered on the trailing edge: How do I achieve the behavior shown in the tutorial's screenshot, where the toggle sidebar button (or, ideally any custom toolbar item I choose) shows up on the leading edge? Even more ideally, is there a way I can make the sidebar toggle button show up in the header section for the sidebar, like it does in Xcode - right next to the stoplight buttons?
1
0
183
May ’24
How can I make NSToolbar on Catalyst check canPerformAction on UISplitViewController's secondary view controller instead of primary?
I have a Catalyst app that I'm adding a sidebar to via UISplitViewController. I have a toolbar on the window with buttons that I want to be enabled or disabled based on the state of the view controller in the split view's secondary column. But it seems to want to check the primary view controller instead. In the Catalyst tutorial Adding a Toolbar, this exact approach is demonstrated. The RecipeDetailViewController has methods for toggleFavorite and editRecipe, and the toolbar items are set up to reference those selectors in the ToolbarDelegate class. In the screenshots in the tutorial, the buttons are shown as enabled based on RecipeDetailViewController.canPerformAction. But when I download and run the complete project on my computer (macOS 14.4.1), the toolbar items are disabled. And if I add the methods to the RecipeListViewController (which is in the primary column of the UISplitViewController, the toolbar items get enabled. Is there a way to make the system ask the correct split view column for canPerformAction? Or is this a bug?
0
0
170
Apr ’24
Remove macOS app from the App Store
Hello, With the new App Store Connect, iOS apps become available on the new Macs with Apple Silicon natively. A couple of my apps got quite some complications with Catalyst and do not need it anymore. I would like to know how to completely remove a platform from App Store Connect, without impacting the iOS version, so that I can let my iOS app be available on the Mac App Store instead of the Catalyst app. Thank you
9
0
11k
Apr ’24
AppKit/Mac Catalyst apps are being rejected by App Review for launching default web browser for login
New versions of AppKit/Mac Catalyst apps that use Google's Sign In framework are being rejected by App Store Review for the past two weeks. Reason shared was: The user is taken to the default web browser to sign in or register for an account, which provides a poor user experience. And also citing: Data Collection & Storage guidelines -> https://developer.apple.com/app-store/review/guidelines/#data-collection-and-storage Opening macOS' default web browser has been a native behavior of Mac apps when using SFSafariViewController with ASWebAuthenticationSession, which is required, since iOS 13, for securely/privately logging in users. As far as I could investigate, there hasn't been any updates to the guidelines that would indicate any required changes to developers in regards to how login works for macOS apps. Are there any steps developers need to take to get updates approved while still providing users with Google's Sign in? As reference, there is an on-going discussion on GoogleSignIn repo about this issue affecting multiple developers and apps: https://github.com/google/GoogleSignIn-iOS/issues/388
2
3
404
Apr ’24
PencilKit's PKToolPicker shows normally on iOS, but not on Mac Catalyst.
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:
3
0
1.4k
Apr ’24
drawHierarchy broken - image too bright
extension UIView { func takeSnapshot(rect : CGRect? = CGRect.zero) -> UIImage? { let renderer = UIGraphicsImageRenderer(size: frame.size) var image = renderer.image { _ in drawHierarchy(in: bounds, afterScreenUpdates: true) } if let imageRect = rect, imageRect != CGRect.zero { let screenshotFrame = CGRect(x: imageRect.origin.x * UIScreen.main.scale, y: imageRect.origin.y * UIScreen.main.scale, width: imageRect.size.width * UIScreen.main.scale, height: imageRect.size.height * UIScreen.main.scale) let imageRef = image.cgImage!.cropping(to: screenshotFrame) image = UIImage.init(cgImage: imageRef!, scale: image.scale, orientation: image.imageOrientation) } UIGraphicsEndImageContext() return image } } which was working fine until I updated to macOS 14.4.1 from 14.2.1 and to Xcode 15.3 from 15.0. issue From my Mac Catalyst app, if I try to take screenshot of imageView, the screenshot is brighter. If I try this method it seems working: func takeSnapshotWithoutScale() -> UIImage? { UIGraphicsBeginImageContextWithOptions(self.frame.size, false, 0) if let currentContext = UIGraphicsGetCurrentContext() { self.layer.render(in: currentContext) } let newImage = UIGraphicsGetImageFromCurrentImageContext() UIGraphicsEndImageContext() return newImage }
2
0
199
Apr ’24
ITMS-90053 Mac Catalyst Invalid Binary
I am really stuck. I uploaded my Mac Catalyst app. The binary passes validation beforehand. I submit for review. After being in "waiting for review" for a couple of minutes it is rejected with "invalid binary" and comes back with an email saying "ITMS-90053: This bundle is invalid - The bundle identifier is already in use by a different software package." The only app that is using the same bundle is the IOS version where I added the Mac platform.
0
0
257
Apr ’24
CGEventTapCreateForPid fails to get event tap
My app uses CGEventTapCreateForPid to monitor keyboard events of a corresponding process. My app has already enabled the Accessibility permission, and AXIsProcessTrustedWithOptions returns true. However, CGEventTapCreateForPid returns null. What could be the problem? Does anyone know? I tested and found that if CGEventTapCreateForPid returns null, I can reset the Accessibility permission using tccutil reset Accessibility myapp_bundleid without restarting my app. But my app can still get the permission through AXIsProcessTrustedWithOptions
1
0
256
Apr ’24