Mac Catalyst

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

Mac Catalyst Documentation

Posts under Mac Catalyst tag

253 results found
Post marked as unsolved
4 Views

How to Reset PhotosAdd Permission on MacOS Big Sur?

I am developing a Mac Catalyst app that allows users to save their paintings as photos to the photo library. The PhotosAdd permission works correctly, but there is no record of this permission inside the "Security & Privacy" settings page. This is a problem for people who accidentally deny the permission and wish to correct the choice. Is there a way to change the PhotosAdd permission in the MacOS GUI? The only solution I have is through terminal using "sudo tccutil reset PhotosAdd appid"
Asked
by jjkaufman.
Last updated .
Post marked as unsolved
6 Views

Reading contents of file dropped in iOS/iPadOS/Mac Catalyst app.

I am currently refactoring my existing (Swift) iOS codebase to run on macOS under Mac Catalyst but am having trouble with reading, loading or even seeing JSON files that are received by my UIDropInteractionDelegate. I am trying to allow users to drop a file snse.json (which is a regular pretty-printed JSON text file) onto a view in my app, but in performDrop, session.items is a single item array with seemingly nothing useful in it. When I throw a breakpoint in performDrop, I get the following debug output: ▿ Optional<NSItemProvider> &#9;- some : <NSItemProvider: 0x600003876ca0> {types = ( &#9;&#9;"public.json", &#9;&#9;"com.apple.finder.node" )} (lldb) po session.items.first?.itemProvider.suggestedName ▿ Optional<String> &#9;- some : "snse.json" (lldb) po session.items.first?.localObject nil (lldb) po session.items.first?.previewProvider nil (lldb) po session.items.first?.itemProvider.canLoadObject(ofClass: URL.self) ▿ Optional<Bool> &#9;- some : false (lldb) po session.items.first?.itemProvider.canLoadObject(ofClass: String.self) ▿ Optional<Bool> &#9;- some : false Below is the code I have so far: class SentimentViewController: UITableViewController { &#9;&#9;override func viewDidLoad() { &#9;&#9;&#9;&#9;super.viewDidLoad() &#9;&#9;&#9;&#9; &#9;&#9;&#9;&#9;self.view.interactions.append(UIDropInteraction(delegate: self)) &#9;&#9;} } extension SentimentViewController: UIDropInteractionDelegate { &#9;&#9; &#9;&#9;static let JSONTypeIdentifier = "public.json" &#9;&#9; &#9;&#9;func dropInteraction(_ interaction: UIDropInteraction, &#9;&#9;&#9;&#9;&#9;&#9;&#9;&#9;&#9;&#9;&#9;&#9; canHandle session: UIDropSession) -> Bool { &#9;&#9;&#9;&#9;return session.hasItemsConforming(toTypeIdentifiers: [JSONTypeIdentifier]) &#9;&#9;} &#9;&#9;func dropInteraction(_ interaction: UIDropInteraction, sessionDidUpdate session: UIDropSession) -> UIDropProposal { &#9;&#9;&#9;&#9;return UIDropProposal(operation: .copy) &#9;&#9;} &#9;&#9;func dropInteraction(_ interaction: UIDropInteraction, performDrop session: UIDropSession) { &#9;&#9;&#9;&#9;/* This is called with an empty array of NSURLs */ &#9;&#9;&#9;&#9;let _ = session.loadObjects(ofClass: URL.self) { urls in &#9;&#9;&#9;&#9;&#9;&#9;for url in urls { &#9;&#9;&#9;&#9;&#9;&#9;&#9;&#9;self.importJSONData(from: url) &#9;&#9;&#9;&#9;&#9;&#9;&#9;&#9;print(url) &#9;&#9;&#9;&#9;&#9;&#9;} &#9;&#9;&#9;&#9;} &#9;&#9;} &#9;&#9; &#9;&#9;private func importJSONData(from url: URL) { &#9;&#9;&#9;&#9;print("I would love to load data from \(url).") &#9;&#9;} } I'm sure I'm doing something wrong, but I just can't tell what. Do I need to request permissions to read local files? Is there a step I missed? Any help is greatly appreciated!
Asked
by _blake.
Last updated .
Post marked as unsolved
14 Views

Conditionally use Big Sur SwiftUI features on MacCatalyst app without dyld crash?

I'm trying to use ColorPicker in a Big Sur Catalyst app. I thought I had wrapped everything in the correct conditionals, but I'm getting a dyld crash on Catalina: Termination Reason:  DYLD, [0x4] Symbol missing Application Specific Information: dyld: launch, loading dependent libraries Dyld Error Message:  Symbol not found: _$s7SwiftUI11ColorPickerVMn  Referenced from: /private/var/folders/*/Metronomics 2.app/Contents/MacOS/APP_NAME (which was built for Mac OS X 14.0)  Expected in: /System/iOSSupport/System/Library/Frameworks/SwiftUI.framework/Versions/A/SwiftUI  in /private/var/folders/*/APP_NAME2.app/Contents/MacOS/APP_NAME Here's my conditional import: if #available(iOS 14.0, macCatalyst 14.0, *) { &#9;ColorPicker("Display color", selection: colorBinding, supportsOpacity: false) } I tried both macCatalyst 11.0 and 14.0 for the conditional (not being sure whether the version number is referring to the macOS number or the underlying iOS number), but neither seemed to have an effect. My deployment target is macOS 10.15.5 Goal: I would like to be able to use ColorPicker on iOS 14 and Big Sur, but the app should run on iOS 13 and Catalina.
Asked
by jnpdx.
Last updated .
Post marked as unsolved
92 Views

SwiftUI Catalyst app on Big Sur losing focus.

I have been working with several SwiftUI apps using Catalyst for Mac support. There seems to be a major issue where the entire app or portions of the app become unresponsive to clicks or other events seemingly because a loss of focus. Sometimes it is recoverable by clicking around random parts of the window, but sometimes it is just stuck. Does anyone know how to get this under control, or perhaps start controlling which parts of the app get focus? Also, when returning from modal states, focus seems to land on a random ui element. I would like to know how to control this.
Asked
Last updated .
Post marked as unsolved
162 Views

onTapGesture unreliable in Big Sur Catalyst apps?

onTapGesture seems like it's incredibly unreliable (eg clicks/taps don't always trigger the onTapGesture closures -- best case is that they're intermittent) in Big Sur for Catalyst apps. The same code runs without problem on iOS 14 and Catalina (again, with Catalyst). Consider the following basic example: struct ContentView: View {     @State private var greenOn = false     @State private var blueOn = false     var body: some View {         HStack {             Rectangle()                 .fill(Color.green)                 .opacity(greenOn ? 1.0 : 0.5)                 .frame(width: 100, height: 100)                 .contentShape(Rectangle())                 .onTapGesture(count: 1, perform: {                     greenOn.toggle()                     print("Tapped")                 })             Rectangle()                 .fill(Color.blue)                 .opacity(blueOn ? 1.0 : 0.5)                 .frame(width: 100, height: 100)                 .onTapGesture(count: 1, perform: {                     blueOn.toggle()                     print("Tapped 2")                 })         }     } } Try to tap the green and blue squares. Best case for me (Big Sur, 11.0.1) is that sometimes onTapGesture will get called. The easy solution is to convert them to Buttons instead -- but, there are plenty of situations where that isn't ideal (Buttons, for example, don't play nicely with DragGesture). Is there any way around this bug? Some way to make it work? Or am I stuck until an update restores functionality with Catalina/iOS 14
Asked
by jnpdx.
Last updated .
Post marked as unsolved
38 Views

SKDownload.progress stops at 0.80

I have ported an iPhone/iPad app to macOS using Catalyst. The existing iPhone/iPad app contains non-consumable in-app purchases, which have been tested and are live in production. No complaints from iPhone/iPad users. I'm having trouble testing hosted content on the macOS version. When I try to download a hosted IAP, the progress continues up to 80%, at which point it stops. If I launch the app from the command line, I can see an error message as "The installation could not be started" and, looking at the path of the downloaded archive, it looks complete. So, if I can trust the log from running from the command line, I suspect there may be some permissions issue in testing macOS hosted content downloads. Here is my current workflow, sign out of App Store and iCloud on my development machine. clean build folder and build for "Any Mac" (though I've also tried "My Mac" with no difference; build scheme checks all boxes: analyze, test, run, profile, archive). find build in the "Products" folder in the left rail. click on "Show in Finder". Launch from Finder. Purchase IAP using sandbox account (tested with an older account used for the iPhone/iPad testing and a new one created after I started testing the macOS version; the "Environment: Sandbox" text appears when I make the purchase). Download starts and goes up to 80%, at which point the SKDownload.state is .failed. Other notes, I also uploaded a macOS build to App Store in the process, though I obviously have not released it. XCode Version 12.2 (12B45b) macOS 10.15.7 (19H2) It looks like there have been previous issues like - https://developer.apple.com/forums/thread/9890 this, - https://stackoverflow.com/questions/28681456/storekit-skdownload-progress-does-not-complete though without clear steps to resolution. Any help would be appreciated. Thanks.
Asked
Last updated .
Post marked as unsolved
55 Views

UIColorPickerViewController on Catalyst

When presenting the UIColorPickerViewController directly in a Catalyst app selecting a color will invoke colorPickerViewControllerDidSelectColor(_ viewController: UIColorPickerViewController) However if you click the "Show Colors" button to see the expanded color selection pop over then the change or selection of colours in this window won't invoke colorPickerViewControllerDidSelectColor(_ viewController: UIColorPickerViewController) and there doesn't seem to be a way to capture the color.
Asked
by DavidNZ.
Last updated .
Post marked as unsolved
18 Views

Xcode Errors - [UIFocus] Focus system disabled

Running macOS 11.0.1 (20B29) with Xcode 12.2 (12B45b), with a brand new Xcode project configured as follows File -> New Project -> iOS -> App Interface: SwiftUI Lifecycle: UIKit App Delegate Language: Swift Uncheck all checkboxes In xcodeproj target, select Mac checkbox Run app on Mac I get the following errors 2020-11-26 21:24:42.940494+0000 Test[85254:1719377] [UIFocus] Focus system disabled 2020-11-26 21:24:43.029918+0000 Test[85254:1719377] [UIFocus] Focus system enabled 2020-11-26 21:24:43.606709+0000 Test[85254:1719377] [UIFocus] Focus system disabled In my actual app, I get a lot more of these - certain interactions like opening a popover can trigger them. If the last message was Focus system enabled, stuff works fine. If the last is Focus system disabled, a load of elements like Toggle and Slider aren't clickable. I couldn't figure out how to get it to end on an enabled state. I also tested this on my DTK and get the same errors on the 11.1 Big Sur beta with 12.3 Xcode beta.
Asked
Last updated .
Post marked as unsolved
19 Views

How are IAP receipts supposed to work when an iOS app runs on an Arm Mac?

Does anyone know how IAPs and receipt validation is supposed to work when an iOS app is run on a new Arm Mac? I have an iOS app which I'm pleased to discover runs well on my new Arm Mac mini. The app has non-consumable IAPs. At startup it parses the app receipt. A receipt is present, but my existing receipt validation code decides that it has the wrong hash. (This is with the app installed from the App Store, not a local build.) I'm aware that receipt validation is different for native Mac apps, including catalyst apps (e.g. getting a device GUID from the ethernet MAC addresses etc.) But what is supposed to happen in the case of a regular iOS app running on macOS? Is this documented anywhere? Has anyone got IAPs working, with local receipt validation?
Asked
by endecotp.
Last updated .
Post marked as unsolved
39 Views

Distribution Profile Type for Mac Catalyst app?

Hi, this might sounds dumb, but to create a distribution profile for Mac Catalyst app, should I choose Mac or Mac Catalyst? When select "Mac Catalyst" type, I saw this message, which concerns me since I don't use any "maccatalyst" prefix for our apps. To generate a provisioning profile for an App ID with a "maccatalyst" prefix, search for the iPad app's App ID. Then select the App ID under "Enabled App IDs with an associated application identifier".
Asked
by limtc.
Last updated .
Post marked as solved
38 Views

Older Catalyst app with extension won't codesign

A macOS Catalyst app with an added extension was successfully built with Xcode 12.1, submitted to the Mac App Store, and approved 2 weeks ago. This macOS Catalyst app was originally built and distributed last year with an Xcode version prior to Xcode 11.4, when the maccatalyst prefix was automatically added to builds. When trying to rebuild and update the project, unchanged except for version and build numbering, using Xcode 12.2, so that Apple Silicon support can be added, codesigning the new archive from the Organizer fails. The error message when trying to Distribute to App Store Connect from the Organizer is: Code signing "rtl_tcp-SDR.app" failed. View distribution logs for more information. The end of the IDEDistributionPipeline.log has this message: 2020-11-16 21:03:11 +0000&#9;Running /usr/bin/codesign '-vvv' '--force' '--sign' 'CD25FBC289AAC880348543822E408B045CD14EAC' '--entitlements' '/var/folders/96/wwd0fl953bg48jzn669wbg1m0000gp/T/XcodeDistPipeline.~~~YB05bp/entitlements~~~RoCzdR' '--preserve-metadata=identifier,flags,runtime' '/var/folders/96/wwd0fl953bg48jzn669wbg1m0000gp/T/XcodeDistPipeline.~~~YB05bp/Root/Applications/rtl_tcp-SDR.app' 2020-11-16 21:03:11 +0000&#9;/var/folders/96/wwd0fl953bg48jzn669wbg1m0000gp/T/XcodeDistPipeline.~~~YB05bp/Root/Applications/rtl_tcp-SDR.app: replacing existing signature 2020-11-16 21:03:11 +0000&#9;/var/folders/96/wwd0fl953bg48jzn669wbg1m0000gp/T/XcodeDistPipeline.~~~YB05bp/Root/Applications/rtl_tcp-SDR.app: code object is not signed at all 2020-11-16 21:03:11 +0000&#9;/usr/bin/codesign exited with 1 There is a note in "About the Mac app built with Mac Catalyst bundle ID" saying: Configuring Projects Created Earlier Than Xcode 11.4 If you created the Mac app built with Mac Catalyst using an earlier Xcode release than 11.4, the Mac app and iPad app have different bundle IDs. The Mac app bundle ID has a maccatalyst prefix followed by the iPad app bundle ID by default. Use the Derive Mac Catalyst Product Bundle Identifier (DERIVE_MACCATALYST_PRODUCT_BUNDLE_IDENTIFIER) build setting to configure your project: If you add an app extension, set the app extension target Derive Mac Catalyst Product Bundle Identifier build setting to YES because the Mac App Store requires that every embedded executable bundle have a bundle ID that is prefixed with the parent bundle ID. But I get the same codesign failure with DERIVE_MACCATALYST_PRODUCT_BUNDLE_IDENTIFIER set to either Yes or No in Build Settings, for either the app or the extension (all 4 combinations tried). Is there an Xcode build setting or a manual codesigning sequence that will codesign an older Catalyst app with an extension so that it can be uploaded to the Mac App Store? Do I need to create an App Identifier for the extension in Certificates, Identifiers & Profiles? With or without a maccatalyst prefix? Etc.
Asked
by hotpaw2.
Last updated .
Post marked as solved
314 Views

App Groups capability is not available for Mac Catalyst provisioning profile

I'm trying to build my iOS app to macOS Catalyst. Everything works fine when running locally on my machine via Xcode, but an error occurs when I archive and try to upload to the notarisation service: Cannot create a Mac Catalyst Developer ID provisioning profile for "br.com.marcosatanaka.music-harbor". The App Groups capability is not available for Mac Catalyst Developer ID provisioning profiles. Disable this feature and try again. I have the App Groups capability enabled on my app's target Signing &amp; Capabilities tab on Xcode. But, when I go to the Apple Developer portal under Certificates, Identifiers &amp; Profiles > Profiles and select the Mac Catalyst provisioning profile (automatically generated by Xcode), the App Groups capability is not present on the Enabled Capabilities section. I can work around this issue by removing the com.apple.security.application-groups entitlement when building for Mac Catalyst, but that causes me a runtime error when Core Data tries to access the store located on the shared container. I also need it to be on a shared container because I want to access the database from both the main app and also the new widget extension. How can I add the App Groups capability to my Mac Catalyst provisioning profile?
Asked
Last updated .
Post marked as unsolved
5 Views

How do I do showInFinder in Mac Catalyst

Using UIApplication openURL will open the file directly, but the file location corresponding to finder cannot be opened. There are many resource files in the folder, so it will be difficult to locate specific files if only the folder is opened
Asked
Last updated .