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

147 Posts
Sort by:
Post not yet marked as solved
0 Replies
160 Views
Hi, In a Mac Catalyst app, I need to allow the user insert a passcode using a UITextField. The field is used to insert a one time passcode and I want to keep the content hidden. For this reason I set the isSecureTextEntry property to true. passcodeTextField.isSecureTextEntry = true By doing this, a button to allow the user to pick a password from the keychain is displayed: This option in my case should not appear because the password is a one time password that change every time. For that reason I set the textContentType to oneTimeCode. passcodeTextField.textContentType = .oneTimeCode This actually removes the password button, but introduce something weird. If the user type something and then delete everything, a big empty box appear under the field: I have no idea what this box is and why it appears. Does anyone know why it appears and how I can remove it? Thank you
Posted
by DaleOne.
Last updated
.
Post not yet marked as solved
3 Replies
791 Views
I've been testing in app purchase using a StoreKit Configuration file in Xcode 13. This is a great feature, and makes things much easier. However, I can't figure out how to reset the state back to initial conditions (i.e. no purchases). On iOS simulators, I have found that the menu command Device->Erase All Content And Settings works. While it's cumbersome, it does the trick. However, I'm testing a Mac catalyst version of my app, and have found several issues with StoreKit testing here. On macOS Big Sur, the reliability of getting a receipt written to my app is very low. Either no _MASReceipt/receipt gets written, or it will get written to for one debugging session, and then stop updating. The only way I have found to get the receipt to update again is to reboot my system. The other, arguably worse problem with Mac catalyst and StoreKit testing, is that I really do need to reset the state to initial conditions. In the course of my app running in the debugger with a very high renewal rate, my receipt has amassed 23,000+ transactions in it. There is no "Reset Contents and Settings" here like in the iOS simulator obviously. And the Xcode transactions editor window comes up empty, so I can't delete them there. I'm sure there's some file/directory somewhere that I can delete, I just have no idea what it is or where to look. Any tips would be appreciated!
Posted
by jrg405.
Last updated
.
Post marked as solved
3 Replies
944 Views
I have be trying to use the sample code project associated with WWDC21 session 10294: Meet MusicKit for Swift, with Catalyst. The apps works on mac correctly excepted the playback and the barcode scanning (that is out of my scope) The following message is displayed continuously: MusicAlbums[30849:533531] [SDKPlayback] Failed to obtain synchronousRemoteObject: Error Domain=NSCocoaErrorDomain Code=4099 "The connection to service named com.apple.Music.MPMusicPlayerApplicationControllerInternal was invalidated: failed at lookup with error 3 - No such process." UserInfo={NSDebugDescription=The connection to service named com.apple.Music.MPMusicPlayerApplicationControllerInternal was invalidated: failed at lookup with error 3 - No such process.} Before diving deeper i wanted to know if some of you have been able to play music via MusicKit with Mac catalyst? The sample code uses an ApplicationMusicPlayer.shared that is not available directly on macOS. (In fact none of the Music players are available) Would you recommend another approach to provide MusicKit playback on mac os ?
Posted Last updated
.
Post not yet marked as solved
0 Replies
218 Views
I have an iOS app that can play audio books as FairPlay DRM'd audio streams. I'm using AVContentKeySession to fetch keys and AVQueuePlayer to play. It works great on iOS, but on Catalyst (Monterey 12.3.1, M1 Max MacBook Pro) it crashes. When it happens in debug, I get a message "Too few bits left in input buffer" printed to the console, and an exception is thrown in the guts of what appears to be core media. Here's the output from [NSThread callStackSymbols] when paused on an exception breakpoint at that point: 0   ???                       0x0000000156b8cc9c 0x0 + 5749918876, 1   BRFree                    0x000000010445cf08 main + 0, 2   AudioCodecs               0x0000000157918c24 _ZL11GetPropertyPvjPjS_ + 52, 3   AudioToolboxCore          0x00000001862536a4 _ZN15ADTSAudioStream11ParseHeaderER27AudioFileStreamContinuation + 1060, 4   AudioToolboxCore          0x000000018624259c AudioFileStreamParseBytes + 412, 5   MediaToolbox              0x00000001915f7d98 FigManifoldCreateForICY + 2176, 6   MediaToolbox              0x00000001915f7718 FigManifoldCreateForICY + 512, 7   MediaToolbox              0x00000001916bbd78 FigPlayerStreamCreate + 315920, 8   MediaToolbox              0x0000000191a269a0 FigMetadataConverterCreateForQuickTimeToFromiTunes + 45888, 9   MediaToolbox              0x0000000191a4a290 FigMetadataConverterCreateForQuickTimeToFromiTunes + 191536, 10  MediaToolbox              0x0000000191a2a470 FigMetadataConverterCreateForQuickTimeToFromiTunes + 60944, 11  MediaToolbox              0x0000000191a28c34 FigMetadataConverterCreateForQuickTimeToFromiTunes + 54740, 12  MediaToolbox              0x0000000191a413b4 FigMetadataConverterCreateForQuickTimeToFromiTunes + 154964, 13  MediaToolbox              0x0000000191a2f144 FigMetadataConverterCreateForQuickTimeToFromiTunes + 80612, 14  MediaToolbox              0x00000001917cae64 FigAlternateFilterMonitorCreateForThermalNotification + 30428, 15  MediaToolbox              0x00000001917ccb44 FigAlternateFilterMonitorCreateForThermalNotification + 37820, 16  MediaToolbox              0x00000001917cb134 FigAlternateFilterMonitorCreateForThermalNotification + 31148, 17  CFNetwork                 0x0000000189937cd4 _CFHostIsDomainTopLevelForCertificatePolicy + 27728, 18  Foundation                0x0000000185ba980c __NSBLOCKOPERATION_IS_CALLING_OUT_TO_A_BLOCK__ + 24, 19  Foundation                0x0000000185ba96b4 -[NSBlockOperation main] + 104, 20  Foundation                0x0000000185ba9644 __NSOPERATION_IS_INVOKING_MAIN__ + 24, 21  Foundation                0x0000000185ba88dc -[NSOperation start] + 788, 22  Foundation                0x0000000185ba85c0 __NSOPERATIONQUEUE_IS_STARTING_AN_OPERATION__ + 24, 23  Foundation                0x0000000185ba8478 __NSOQSchedule_f + 184, 24  libdispatch.dylib         0x00000001099f60f4 _dispatch_block_async_invoke2 + 148, 25  libdispatch.dylib         0x00000001099e2394 _dispatch_client_callout + 20, 26  libdispatch.dylib         0x00000001099eb778 _dispatch_lane_serial_drain + 980, 27  libdispatch.dylib         0x00000001099ec814 _dispatch_lane_invoke + 492, 28  libdispatch.dylib         0x00000001099f9fc8 _dispatch_root_queue_drain + 408, 29  libdispatch.dylib         0x00000001099f9d3c _dispatch_worker_thread + 264, 30  libsystem_pthread.dylib   0x00000001094e1890 _pthread_start + 148, 31  libsystem_pthread.dylib   0x00000001094ebaa8 thread_start + 8 In the Debug Navigator, the top of the stack looks a little different: #0 0x0000000184bdeb3c in __cxa_throw () #1 0x000000015791941c in ACMP4AACLowComplexityDecoder::GetProperty(unsigned int, unsigned int&, void*) () #2 0x0000000157918c24 in GetProperty(void*, unsigned int, unsigned int*, void*) () #3 0x00000001862536a4 in ADTSAudioStream::ParseHeader(AudioFileStreamContinuation&) () #4 0x000000018624259c in AudioFileStreamParseBytes () #5 0x00000001915f7d98 in ___lldb_unnamed_symbol598$$MediaToolbox () What's going wrong here? Can anyone give me direction on what to fix? Or is FairPlay audio not even expected to work in Catalyst at this point?
Posted Last updated
.
Post not yet marked as solved
1 Replies
546 Views
I'm trying to associate a custom file type and extension with my Mac Catalyst app. On the Mac, I can get this to work by adding the following key/values to my Info.plist: keyCFBundleDocumentTypes/key array dict keyCFBundleTypeName/key stringCustomUTI/string keyCFBundleTypeRole/key stringEditor/string keyLSHandlerRank/key stringOwner/string keyLSItemContentTypes/key array stringcom.jnpdx.customuti/string /array /dict /array keyUTExportedTypeDeclarations/key array dict keyUTTypeConformsTo/key array stringpublic.data/string /array keyUTTypeDescription/key stringCustomUTI/string keyUTTypeIcons/key dict/ keyUTTypeIdentifier/key stringcom.jnpdx.customuti/string keyUTTypeTagSpecification/key dict keypublic.filename-extension/key array stringcustomuti/string /array keypublic.mime-type/key array stringcustom/uti/string /array /dict /dict /array Once I've modified the Info.plist, sometimes I have to build my app in Xcode and then drag the product to the Applications directory before launchd will associate the file type correctly. Once I do this, my app appears in the "Open with..." menu. However, the steps do not appear to work for a Catalyst target. If you look at the Twitter thread that I linked to before, it suggested that the Applications folder trick worked at one point, but I have had no luck getting it to work in Big Sur (I'm running 11.2.3). I've created a sample repo (including a couple of sample files) that you can try this out with so a tester can avoid the process of creating the targets. There is nothing here except for a "Hello, world!" app with the Info.plist set up as described above, with a macOS native target and a Catalyst target. (Remember the hint about dragging to Applications): https://github.com/jnpdx/MacNativeUTITest
Posted
by jnpdx.
Last updated
.
Post marked as solved
2 Replies
326 Views
Hi, in my app the user can choose between a light and a dark appearance. This is done by setting the overrideUserInterfaceStyle of the window. On macOS (Catalyst) the app uses an NSToolbar, which always appears in the mode set for the system, regardless what ist set for the overrideUserInterfaceStyle of the window (see screenshot). Since this is not a good visual impression, I would like to know how I can set light/dark mode for the NSToolbar too.
Posted Last updated
.
Post marked as solved
2 Replies
1.2k Views
I'm attemping to use UIDocumentPickerViewController, but when I run the app in development, I get an entitlements error:[OpenSavePanels] ERROR: Unable to display save panel: your app is missing the User Selected File Read/Write app sandbox entitlement. Please ensure that your app's target capabilities include the proper entitlements.My entitlements do incldue "User Selected File: Read/Write" in the App Sandbox section.I'm using "Automatically manage signing" and I tried clearing out all provisioning profiles, but this doesn't seem to help.
Posted Last updated
.
Post not yet marked as solved
1 Replies
1k Views
Hi, guys! I created a empty Xcode project with catalyst support and added one dependency YandexMobileMetrica via Swift Package Manager. YandexMobileMetrica not support Catalyst architecture, so I need exclude this framework for macOS. I opened section "Frameworks, Libraries" and I switched value from "iOS + macOS" to "iOS". Then I wrapped the code: #if !targetEnvironment(macCatalyst) import YandexMobileMetrica #endif But I'm getting an error: language While building for Mac Catalyst, no library for this platform was found in '/Users/mezhevikin/Library/Developer/Xcode/DerivedData/catalyst-spm-test-gapaedifaylhvwatazbwfppyplvj/SourcePackages/artifacts/YandexMobileMetrica/YandexMobileMetricaCrashes.xcframework'. https://github.com/mezhevikin/catalyst-spm-test - example of problem How to exclude SPM dependency for Catalyst?
Posted Last updated
.
Post not yet marked as solved
4 Replies
557 Views
I'm porting my iPhone/iPad App to Mac Catalyst. First time I ran it got "Use Location while in use" pop up, gave consent. Next time I ran it - the consent is saved which is OK. I want to delete all settings and test from scratch. Deleted the folder in Library/Containers, derived data folder. But these settings are stored somewhere else. Where are they stored?  
Posted Last updated
.
Post not yet marked as solved
5 Replies
1.1k Views
In my WKWebview, if I right click (macCatalyst) or long press (ios) paste, it only paste text once. But if I Cmd-V to paste, it will paste text twice with a space between the 2 copied text. This is my log (canPerform action always return true): -canPerformAction() action : paste: -canPerformAction() action : paste: -canPerformAction() action : paste: -canPerformAction() action : paste: -canPerformAction() action : newWindowForTab: -2021-12-17 09:50:17.101763-0500 myApp[18815:1434268] *** Assertion failure in -[UINSResponderProxy _initWithWrappedResponder:orMenuProxy:forAction:sender:], UINSResponderProxy.m:250 -[UINSResponderProxy _initWithWrappedResponder:orMenuProxy:forAction:sender:]: UINSResponderProxy is improperly wrapping a responder that does not respond to the action. -canPerformAction() action : paste: -canPerformAction() action : paste: -canPerformAction() action : paste:
Posted
by ShaddamIV.
Last updated
.
Post not yet marked as solved
0 Replies
232 Views
In the documentation, UIScreen supports Mac Catalyst https://developer.apple.com/documentation/uikit/uiscreen/ but when I actually do UIScreen.screens with mac catalyst, I only get the main screen and cannot detect the external display. import SwiftUI struct ContentView: View {       @EnvironmentObject var externalDisplayContent: ExternalDisplayContent       var body: some View {     VStack {       Button("Display"){         print(UIScreen.screens)       }     }   }     } struct ContentView_Previews: PreviewProvider {       static var previews: some View {     ContentView()   }     }
Posted
by rakutek.
Last updated
.
Post not yet marked as solved
1 Replies
264 Views
I can successfully connect and show ExternalView() on the external display on IOS target. However, mac catalyst is unable to detect the display connection in NotificationCenter. How do I use NotificationCenter in mac catalyst to detect and connect an external display? import Combine import SwiftUI @main struct ScreensApp: App {   @ObservedObject var externalDisplayContent = ExternalDisplayContent()   @State var additionalWindows: [UIWindow] = []   private var screenDidConnectPublisher: AnyPublisher<UIScreen, Never> {     NotificationCenter.default       .publisher(for: UIScreen.didConnectNotification)       .compactMap { $0.object as? UIScreen }       .receive(on: RunLoop.main)       .eraseToAnyPublisher()   }   private var screenDidDisconnectPublisher: AnyPublisher<UIScreen, Never> {     NotificationCenter.default       .publisher(for: UIScreen.didDisconnectNotification)       .compactMap { $0.object as? UIScreen }       .receive(on: RunLoop.main)       .eraseToAnyPublisher()   }   var body: some Scene {     WindowGroup {       ContentView()         .environmentObject(externalDisplayContent)         .onReceive(           screenDidConnectPublisher,           perform: screenDidConnect         )         .onReceive(           screenDidDisconnectPublisher,           perform: screenDidDisconnect         )     }   }   private func screenDidConnect(_ screen: UIScreen) {     print("connected")     let window = UIWindow(frame: screen.bounds)     window.windowScene = UIApplication.shared.connectedScenes       .first { ($0 as? UIWindowScene)?.screen == screen }       as? UIWindowScene     let view = ExternalView()       .environmentObject(externalDisplayContent)     let controller = UIHostingController(rootView: view)     window.rootViewController = controller     window.isHidden = false     additionalWindows.append(window)     externalDisplayContent.isShowingOnExternalDisplay = true   }   private func screenDidDisconnect(_ screen: UIScreen) {     print("disconnected")     additionalWindows.removeAll { $0.screen == screen }     externalDisplayContent.isShowingOnExternalDisplay = false   } }
Posted
by rakutek.
Last updated
.
Post not yet marked as solved
15 Replies
2k Views
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?
Posted
by endecotp.
Last updated
.
Post marked as solved
12 Replies
12k Views
Seeing these when trying to create an xcframework for Apple Silicon that supports Mac Catalyst and the iOS Simulator: Both ios-arm64-simulator and ios-x86_64-simulator represent two equivalent library definitions. Both ios-arm64-maccatalyst and ios-x86_64-maccatalyst represent two equivalent library definitions. Here's the command: xcodebuild -create-xcframework \ &#9;&#9;-framework ./xcframework-build/catalyst-x86_64/opencv2.framework \ &#9;&#9;-framework ./xcframework-build/catalyst-arm64/opencv2.framework \ &#9;&#9;-framework ./xcframework-build/osx-x86_64/opencv2.framework \ &#9;&#9;-framework ./xcframework-build/osx-arm64/opencv2.framework \ &#9;&#9;-framework ./xcframework-build/iphonesimulator-arm64/opencv2.framework \ &#9;&#9;-framework ./xcframework-build/iphonesimulator-x86_64/opencv2.framework \ &#9;&#9;-framework ./xcframework-build/iphoneos-arm64/opencv2.framework \ &#9;&#9;-output ./xcframework-build/opencv2.xcframework From my understanding fat binaries for these frameworks isn't valid, but maybe it is in this case? These are static frameworks if that matters at all. Using Xcode 12.2 RC.
Posted Last updated
.
Post not yet marked as solved
2 Replies
524 Views
I know macOS doesn't allow running multiple instances of an application in normal circumstances. However, for macOS native applications, there is a work around of using -n in the command line. Unfortunately, this option doesn't seem to work for iOS applications running on iOS. Also, I have been having issues with locations services working correctly when running such an instance. For example, if a game requires doing a GPS location check, it does not seem to be able to do it correctly when running the application in macOS, the app doesn't freeze, but it gets stuck and needs to be restarted. I have looked around online and searched around in settings for quite a bit of time with no success. Any ideas?
Posted Last updated
.
Post marked as solved
1 Replies
220 Views
Hi, I'm storing a string on a named UIPasteboard, and when reading it back, it comes as nil. It works fine on iOS, but on MacCatalyst it always returns nil. I store it like that: let p = UIPasteboard(name: UIPasteboard.Name(rawValue: "aaa"), create: true)! p.string = "some text" print("hasStrings: \(p.hasStrings)") // hasStrings: true and I read it like that: let p = UIPasteboard(name: UIPasteboard.Name(rawValue: "aaa"), create: false)! print("hasStrings: \(p.hasStrings)") // hasStrings: false I'm running the two pieces of code from two different methods of a UIViewController. Say I store the string in 'viewWillAppear', and read it back in 'viewDidAppear'.
Posted Last updated
.
Post not yet marked as solved
0 Replies
307 Views
When I move my app's window to another (external) monitor, scale factor is changed and I have to make some changes related to UIScreen.scale. How do I detect that my app's window has been moved to another screen? It's catalyst project. I tried UIViewController.willTransitionToTraitCollection but it's not called
Posted
by taphome.
Last updated
.
Post not yet marked as solved
3 Replies
425 Views
My standard "native" Mac app uses Catalyst helper. Helper is registered as Login Item via SMLoginItemSetEnabled. I tried to establish XPC communication between these process but I failed. Is it possible to configure XPC connection between these two apps (mac host and catalyst helper)? As far as I can understand it is possible to create XPC connection in Catalyst via passing listener endpoint. However how to send this endpoint between helper and host app? NSXPCListener.init(machServiceName:) is not available for Catalyst app.
Posted
by Malauch.
Last updated
.