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

181 Posts
Sort by:
Post marked as solved
3 Replies
111 Views
While working on the Mac Catalyst version of my iOS app, I noticed something interesting. I have a UITextView with the allowsEditingTextAttributes property enabled. When running the app on a Mac, the context menu that appears when right-clicking inside the UITextField includes the menu item "Import from iPhone or iPad". That brings up a menu with 3 options each for my iPhone and iPad that I happen to connected to my Mac recently. There options include "Take Photo", "Scan Documents", and "Add Sketch". I created a brand new iOS app project and simply added a UITextView to the main view controller. After setting allowsEditingTextAttributes to true, it shows the same behavior. Some questions: Is this documented anywhere? I'm guessing this is related to Continuity Camera in some way. But there's no mention of this anywhere that I've seen so far. How can I prevent this menu from appearing? Nothing related to these menus comes through the canPerformAction(_:withSender:) method. And nothing related to these menus is part of the menu item array sent to the UITextViewDelegate textView(_:editMenuForTextIn:suggestedActions:) method. I need to remove this menu in my app because while I support some text attributes (bold, italic, underline), I do not want to allow pictures to be added. Does anything else in iOS under Mac Catalyst automatically get similar support? If so, what?
Posted
by RickMaddy.
Last updated
.
Post not yet marked as solved
0 Replies
76 Views
Hello, I have my largely iOS app running using Mac Catalyst, but I need to limit what Macs will be able to install it from the Mac App Store based on the GPU Family like MTLGPUFamily.mac2. Is that possible? Or I could limit it to Apple Silicon using the Designed for iPad target, but I would prefer to use Mac Catalyst instead of Designed for iPad. Is it possible to limit Mac Catalyst installs to Apple Silicon Macs? Side question: what capabilities are supported by MTLGPUFamily.mac2? I can't find it. My main interest is in CoreML inference acceleration. Thank you.
Posted
by 3DTOPO.
Last updated
.
Post not yet marked as solved
5 Replies
298 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
.
Post not yet marked as solved
2 Replies
433 Views
Hello. There is a "Highlight" context menu option that shows up when a user right-clicks some selected text in a PDF. There is no way to get rid of this menu item and clicking it does nothing. How do I get rid of it? I tried overriding buildMenu(with builder: UIMenuBuilder) to remove it but that doesn't work. Help!
Posted Last updated
.
Post not yet marked as solved
0 Replies
88 Views
I'm experimenting with getting my AUv3 plugins working correctly on iOS and MacOS using Catalyst. I'm having trouble getting the plugin windows to look right in Logic Pro X on MacOS. My plugin is designed to look right in Garageband's minimal 'letterbox' layout (1024x335, or ~1:3 aspect ratio) I have implemented supportedViewConfigurations to help the host choose the best display dimensions On iOS this works, although Logic Pro iPad doesn't seem to call supportedViewConfigurations at all, only Garageband does. On MacOS, Logic Pro does call supportedViewConfigurations but only provides oversized screen sizes, making the plugins look awkward. I can also remove the supportedViewConfigurations method on MacOS, but this introduces other issues: I guess my question boils down to this: how do I tell Logic Pro X on MacOS what the optimal window size of my plugin is, using Mac Catalyst?
Posted
by Brambos.
Last updated
.
Post marked as solved
5 Replies
2.5k Views
My own iOS app is using AVFoundation to do barcode scanning. Under Mac Catalyst I'm getting an error. Turns out the Apple provided AVCam demo app has the exact same issue.Both the Swift and Objective-C versions of the AVCam demo app fail but the Objective-C version gives a better error so I'll refer to that in the rest of the question.In the AVCamCameraViewController, the configureSession method fails on the line:AVCaptureDeviceInput* videoDeviceInput = [AVCaptureDeviceInput deviceInputWithDevice:videoDevice error:&error];The error is:Could not create video device input: Error Domain=AVFoundationErrorDomain Code=-11814 "Cannot Record" UserInfo={NSLocalizedDescription=Cannot Record, NSLocalizedRecoverySuggestion=Try recording again.}It turns out that none of the three attempts to call [AVCaptureDevice defaultDeviceWithDeviceType:... are succeeding.This is the same error I get in my own app though I only attempt to call [AVCaptureDevice defaultDeviceWithMediaType:AVMediaTypeVideo]; which is also returning nil.Permission was granted for the app to access the camera.There is nothing related to this issue in the release notes for macOS 10.15. I am running the GM version of 10.15 with Xcode 11.1 on a 2018 15" Macbook Pro.How do we successfully get a video capture device under Mac Catalyst?
Posted
by RickMaddy.
Last updated
.
Post not yet marked as solved
2 Replies
1.4k Views
In my iPad app running under macOS Catalyst I would like to modify the context menu that appears when you right-click on a UITextViiew but I can't figure out how.I have overridden the buildMenuWithBulder:/buildMenu(with:) method from UIResponder in my view controller and app delegate but none are called when right-clicking on a UITextView.I have been able to disable a couple of the menu options by subclassing UITextView and overriding the canPerformAction:withSender:/canPerformAction(_:withSender:) and targetForAction:withSender:/target(_:withSender:) methods but I can't remove/disable most of the menu.I also overrode the validateCommand:/validate(_:) method in my UITextView subclass and that was only called for a small subset of the menus I wish to remove/disable.The Menus sample app only shows how to modify the app's main menu and how to add a context menu to a view controller but there is no info on how to modify the context menu of a control such as UITextView.Does anyone know how to do this?Specifically I want to remove the Show Fonts and Show Colors menus under Font and I wish to remove the whole Substitutions menu. The allowsEditingTextAttributes property of the text view is enabled which is what makes the Font portion of the menu appear. I want to keep the Bold/Italic/Underline toggles.
Posted
by RickMaddy.
Last updated
.
Post not yet marked as solved
0 Replies
115 Views
Hi, we prepared Mac Catalyst version for our iOS app. We used same bundle id, so that according to documentation, all in app purchases and subscriptions should work. It works when we testing it agains testing in app subscription server. However, when we sent app to review, we got feedback, that inapp subscriptions doesn't work and from the screenshots from reviewer it looks like they are not available at all (the app even didn't show prices for inapp purchases). Is there anything I have to do to have existing subscriptions available for Mac Catalyst app? I didn't see any settings, so I thought it will work automatically, but it doesn't. Thanks,
Posted
by sarsonj2.
Last updated
.
Post not yet marked as solved
10 Replies
1.9k Views
I would like to remove the title bar of the catalyst version of my app, but it does not work on Ventura. It used to work on Monterey. I am using AppDelegate lifecycle. I am following the official documentation: https://developer.apple.com/documentation/uikit/mac_catalyst/removing_the_title_bar_in_your_mac_app_built_with_mac_catalyst The code: 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 }
Posted Last updated
.
Post not yet marked as solved
5 Replies
389 Views
The test field was originally centered. However, as I tap on it, it was brought to the left. This UI issue occurs on macOS 13.2, built on My Mac(Designed for iPad), while running on iPad is totally fine. Xcode 14.2 and 14.1 has the same behaviour. import UIKit class ViewController: UIViewController { let textField: UITextField = { let textField = UITextField() textField.translatesAutoresizingMaskIntoConstraints = false textField.backgroundColor = .green textField.textAlignment = .center textField.text = "Hello, World" return textField }() override func viewDidLoad() { super.viewDidLoad() view.addSubview(textField) NSLayoutConstraint.activate([ textField.widthAnchor.constraint(equalToConstant: 200), textField.heightAnchor.constraint(equalToConstant: 50), textField.centerXAnchor.constraint(equalTo: view.centerXAnchor), textField.centerYAnchor.constraint(equalTo: view.centerYAnchor) ]) } } How can I fix this?
Posted
by ji3g4kami.
Last updated
.
Post not yet marked as solved
3 Replies
718 Views
CoreUI is sending warning messages to the Xcode console when creating a UIImage from an image file with Mac idiom from the asset catalog, while running on Catalyst. My target is set to support running on Mac Catalyst with Optimize for Mac enabled (the latter seems to be the most important part). Loading the image into a UIImage with the designated initializer and presenting it in a UIImageView produces the following console messages: 2023-02-15 10:53:18.014394+0100 CatalystImageConsoleMessage[64253:8834791] [framework] CoreUI: _Bool CUIValidateIdiomSubtypes(NSInteger, NSUInteger *) got a device subtype '32401' that it match with idiom '7':mac. Assuming subtype should be 0 instead. 2023-02-15 10:53:18.014446+0100 CatalystImageConsoleMessage[64253:8834791] [framework] CoreUI: _Bool CUIValidateIdiomSubtypes(NSInteger, NSUInteger *) got a device subtype '32401' that it match with idiom '7':mac. Assuming subtype should be 0 instead. 2023-02-15 10:53:18.014503+0100 CatalystImageConsoleMessage[64253:8834791] [framework] CoreUI: _Bool CUIValidateIdiomSubtypes(NSInteger, NSUInteger *) got a device subtype '32401' that it match with idiom '7':mac. Assuming subtype should be 0 instead. 2023-02-15 10:53:18.014533+0100 CatalystImageConsoleMessage[64253:8834791] [framework] CoreUI: _Bool CUIValidateIdiomSubtypes(NSInteger, NSUInteger *) got a device subtype '32401' that it match with idiom '7':mac. Assuming subtype should be 0 instead. Working with more than a handful of images from the catalog makes the Xcode console output borderline unreadable because of these messages. The console doesn't have an option to filter out messages (and in general we consider it bad practice to ignore messages on the console). Tested on Xcode 14.2 with macOS 13.2. You can find a sample project at https://github.com/tamasjager/CatalystImageConsoleMessage.
Posted Last updated
.
Post not yet marked as solved
0 Replies
140 Views
We have a Mac Catalyst app that is installed and works with a custom Safari extension. The Safari is working as expected and is able to pass messages (using sendNativeMessage) to the Mac Catalyst app as expected. Now we want to port the extension to Chrome and other browsers on the desktop and retain the ability to pass messages back and forth. My questions: Is it possible ? Can we pass messages form the Chrome extension and the Mac Catalyst app? How do we distribute/install the Chrome extension? Can we have the extension running in parallel across multiple browsers and still communicate the Mac Catalyst app ?
Posted
by vmvinoth.
Last updated
.
Post not yet marked as solved
0 Replies
125 Views
While dropping a file from Finder into our app works as expected – dropping from Mail behaves differently on the Mac (works fine on iPad): [session hasItemsConformingToTypeIdentifiers:…] is false for the type identifier of the dragged file. The session only contains an item for "public.url" and that is also the only thing I can ever get from the item provider. [itemProvider loadItemForTypeIdentifier:@"public.url" options:nil completionHandler:^(NSData* item, NSError* error) { is described to do a coercion: "The contents of the URL is read and returned as NSData" but the data returned is just the NSData encoding of the URL. The URL is also not accessible –  not even when invoking startAccessingSecurityScopedResource first. The console reports: Failed to get a sandbox extension I tried adding the com.apple.security.files.bookmarks.document-scope and com.apple.security.files.bookmarks.app-scope entitlement, but that did not help either.
Posted
by stele.
Last updated
.
Post not yet marked as solved
1 Replies
211 Views
I'm trying to handle a mouse scroll wheel in one of my views (to invoke my zoomIn/zoomOut methods) using a UIPanGestureRecognizer with: UIPanGestureRecognizer* panRecognizer = [[UIPanGestureRecognizer alloc] initWithTarget:myView action:@selector(handlePanGesture:)]; panRecognizer.allowedScrollTypesMask = UIScrollTypeMaskDiscrete; [myView addGestureRecognizer:panRecognizer]; My handlePanGesture method is successfully called twice (once for UIGestureRecognizerStateBegan and UIGestureRecognizerStateEnded), but... then what do I do? The passed UIPanGestureRecognizer* has numberOfTouches = nil, and I can't get any further info about the scroll wheel UIEvent from UIGestureRecognizer or its superclass. How to I tell if it was a scroll up, or a scroll down? See: wwdc20-10094
Posted Last updated
.
Post not yet marked as solved
1 Replies
169 Views
I have submitted FB12157356 for an issue where Mac Catalyst does not play nicely with NSToolBar. Supposedly clickable items in the toolbar do not enable when they should. This is from the Mac Catalyst tutorial at https://developer.apple.com/tutorials/mac-catalyst/updating-the-app-icon Here is what I wrote: In the tutorial https://developer.apple.com/tutorials/mac-catalyst/updating-the-app-icon there is the completed Catalyst xcode project (in the Complete folder). I downloaded and ran the completed project in Xcode Version 14.2, using my Mac OS 12.6.5 to run it. The NSToolBar at the top of the window has the toolbar items for edit and favorite, but they remain greyed out and don't do anything when a recipe is selected. The selectors seem to be set properly for their actions in the ToolBarDelegate file but nothing happens when I select a recipe and the DetailViewController displays the recipe, which it appears you have to do in order for those toolbar items to work. Those buttons never appear to be enabled at all even though I have selected a recipe and the sample coding seems correct. Steps to Reproduce: Download and open the Xcode project in the "Complete" folder from the link provided above. Run the project with Mac as the the simulator target. Select a recipe The toolbar edit icon should be enabled and should display the RecipeEditorViewController when clicked. The favorite (heart) icon should be filled if the recipe is a favorite, and allow you to favorite a recipe if it isn't already a favorite. Interestingly, if you enable the Touch Bar when running the app from Xcode, the Touch Bar displays the edit and favorite icons correctly and the react properly to touches. If anyone has time to look at the tutorial and any suggestion for a workaround so that the toolbar items work correctly I'd love to hear it. Catalyst has lots of potential but this apparent bug isn't helping.
Posted
by zewkini.
Last updated
.
Post not yet marked as solved
3 Replies
1.3k Views
I'm building an app to manage and edit some files. To do that, I want to open the files in place dropping them into a view. I cannot find a way to obtain the file URL after the drop operation. If I constrain the file types to .fileURL, the drop frame doesn't activate. If I use .data, I get the file and not the path, which is what I want. Any way to do this the SwiftUI way? .onDrop(of: [.fileURL], isTargeted: $dragOver) { providers -> Bool in providers.first?.loadDataRepresentation(forTypeIdentifier: "public.file-url", completionHandler: { (data, error) in                             if let data = data {                                 print(data.description)                             }                         })                         return true }
Posted
by airbolt.
Last updated
.
Post not yet marked as solved
4 Replies
220 Views
Hi, I'm building an app for iPhone, iPad and Mac (Mac Catalyst). Unfortunately when I'm adding Family Controls capability to project I'm unable to run Mac Catalyst version of app. Everything is compiling, it fails when run and shows "Could not launch App" Launch Service error IDELaunchErrorDomain: code 20 RBSRequestErrorDomain: code 5 NSPOSIXErrorDomain: code 153 iOS version work without any problems and Screen Time releated Api too. My minimum deployment target is iOS 15. Our permission for Family Controls to distribute in AppStore is currently processing but I guess it shouldn't has influence as I'm running debug. Best, Marcin
Posted
by Mwloczko.
Last updated
.
Post not yet marked as solved
0 Replies
165 Views
In our app we show a pre-alert screen before requesting tracking authorization. For this, we check ATTrackingManager.trackingAuthorizationStatus. On iOS, everything works as expected. On Mac Catalyst however, ATTrackingManager.requestTrackingAuthorization returns immediately with .notDetermined as result and without presenting a system alert. Is this a bug, or is ATT actually not needed for Mac Catalyst apps? Running macOS 13.3.1, app deployment target iOS 15. Sample code: public func shouldAskForPermission() -> Bool { switch ATTrackingManager.trackingAuthorizationStatus { case .authorized, .denied, .restricted: return false case .notDetermined: return true @unknown default: return true } } public func requestTrackingAuthorization(completion: @escaping ((GA4Event) -> Void)) { ATTrackingManager.requestTrackingAuthorization { status in switch status { case .notDetermined: // on macOS, always .notDetermined
Posted Last updated
.
Post marked as solved
1 Replies
191 Views
Hi, I want to set minimum macOS version higher to avoid those messages, because I need video access for my app. However, I cannot see minimum target settings in General tab for Mac - there is only setting for iOS. I tried to set minimum Mac version to latest one in Build phases settings, but this doesn't help. In older versions of Xcode, there was dropdown for both iOS and Mac, but I cannot see it in latest Xcode 14.2. Any idea, how to set it?
Posted
by sarsonj2.
Last updated
.