Mac Catalyst

RSS for tag

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

Posts under Mac Catalyst tag

114 Posts
Sort by:

Post

Replies

Boosts

Views

Activity

DocumentGroup Fails to Display Document Content in Mac Catalyst App
When running a Mac Catalyst app that uses DocumentGroup, the app fails to display the document content. The document picker works as expected, but creating a new document or opening an existing one results in an empty window. This issue occurs regardless of whether “Optimize for Mac” or “Scale iPad” is selected. Steps to Reproduce: 1. Download the sample project provided by Apple for building a document-based app in SwiftUI. 2. Delete the macOS version of the project. 3. Add a Mac Catalyst version of the app. 4. In the Mac Catalyst settings, select “Optimize for Mac” (the bug also appears if it is “Scale iPad”). 5. Run the project on macOS. Expected Result: The app should correctly display the content of the document when creating or opening it. Actual Result: The app opens an empty window when a new document is created or an existing one is opened. Impact: We have received multiple 1-star reviews, and our retention has dropped by two-thirds due to this issue. Environment: Xcode 16.1; macOS 15.1 & 15.2 (on 15.0 it works fine) Has anyone experienced the same issue? I filed multiple reports so far.
1
0
82
1d
activateSceneSession (or requestSceneSessionActivation) always creates new Scene
I'm trying to implement a Help Window from Help Menu in macOS (Mac Catalyst). I have SceneConfiguration in Info.plist and multi-window enabled. Tapping Help menu opens a new Help Window on macOS. I thought it was working great! Unfortunately, tapping Help menu again opens a new Help Window. I only want one Help window to be shown. I expected UIApplication.shared.activateSceneSession(for: request) to use an existing UIScene if one was already present. In my experience I always get a new Scene and thus a new Window. What am I missing? AppDelegate.swift func application(_ application: UIApplication, configurationForConnecting connectingSceneSession: UISceneSession, options: UIScene.ConnectionOptions) -> UISceneConfiguration { // It's important that each UISceneConfiguration have a unique configuration name. var configurationName: String! switch options.userActivities.first?.activityType { case UserActivity.HelpMenuActivityType: configurationName = SceneConfiguration.helpWindowConfiguration default: configurationName = SceneConfiguration.defaultConfiguration } return UISceneConfiguration(name: configurationName, sessionRole: connectingSceneSession.role) } override func buildMenu(with builder: UIMenuBuilder) { super.buildMenu(with: builder) ... builder.remove(menu: .help) builder.insertSibling(helpMenu(), afterMenu: .window) } func helpMenu() -> UIMenu { let children: [UIAction] = [ UIAction(... ) { [weak self] action in self?.helpMenuTappedHandler(action) } ] .... } func helpMenuTappedHandler(_ action: UIAction) { let userActivity: NSUserActivity = ... userActivity.targetContentIdentifier = ... let options: UIScene.ActivationRequestOptions = .init() options.requestingScene = ... let request: UISceneSessionActivationRequest = .init(role: .windowApplication, userActivity: userActivity, options: options) UIApplication.shared.activateSceneSession(for: request, errorHandler: handleHelpError) }
2
0
114
6d
How can I get WiFi SSID in Mac Catalyst?
I just want Mac Catalyst app can look up the SSID of the currently connected WiFI. Xcode returns I can't use CoreWLan in Mac Catalyst, so I used NEHotspotNetwork, although I do not have convince whether Mac Catalyst allows it. The same code of destination works fine on iPhone, but not on Mac Catalyst and Mac(Designed for iPad). What is the proper way to get SSID of WiFI in Mac Catalyst? Is there another way to do this? The code I tried is below and I used CoreLocation API before call this function. func getWiFiSsid() { NEHotspotNetwork.fetchCurrent { network in if let network = network { print(network) } else { print("network is nil!") } } } Below is Entitlement file. Entitlements for app sandbox is removed when I run in Mac(Designed for iPad). <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> <plist version="1.0"> <dict> <key>com.apple.developer.networking.HotspotConfiguration</key> <true/> <key>com.apple.developer.networking.networkextension</key> <array/> <key>com.apple.developer.networking.wifi-info</key> <true/> <key>com.apple.security.app-sandbox</key> <true/> <key>com.apple.security.network.client</key> <true/> <key>com.apple.security.network.server</key> <true/> <key>com.apple.security.personal-information.location</key> <true/> </dict> </plist> Below is Info.plist file. <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> <plist version="1.0"> <dict> <key>CFBundleDevelopmentRegion</key> <string>$(DEVELOPMENT_LANGUAGE)</string> <key>CFBundleExecutable</key> <string>$(EXECUTABLE_NAME)</string> <key>CFBundleIdentifier</key> <string>$(PRODUCT_BUNDLE_IDENTIFIER)</string> <key>CFBundleInfoDictionaryVersion</key> <string>6.0</string> <key>CFBundleName</key> <string>$(PRODUCT_NAME)</string> <key>CFBundlePackageType</key> <string>APPL</string> <key>CFBundleShortVersionString</key> <string>1.0</string> <key>CFBundleVersion</key> <string>1</string> <key>LSRequiresIPhoneOS</key> <true/> <key>UILaunchStoryboardName</key> <string>LaunchScreen</string> <key>UIMainStoryboardFile</key> <string>Main</string> <key>UIRequiredDeviceCapabilities</key> <array> <string>armv7</string> </array> <key>UISupportedInterfaceOrientations</key> <array> <string>UIInterfaceOrientationPortrait</string> <string>UIInterfaceOrientationLandscapeLeft</string> <string>UIInterfaceOrientationLandscapeRight</string> </array> <key>UISupportedInterfaceOrientations~ipad</key> <array> <string>UIInterfaceOrientationPortrait</string> <string>UIInterfaceOrientationPortraitUpsideDown</string> <string>UIInterfaceOrientationLandscapeLeft</string> <string>UIInterfaceOrientationLandscapeRight</string> </array> <key>NSLocationUsageDescription</key> <string>Determine whether the ssid of current Wi-Fi connection</string> <key>NSLocationWhenInUseUsageDescription</key> <string>Determine whether the ssid of current Wi-Fi connection</string> </dict> </plist> The console log is below. NEHotspotNetwork nehelper sent invalid result code [1] for Wi-Fi information request
1
0
79
5d
Screen capture notification in MacOs catalyst
We have a IOS app and we are using the same app for Mac Catalyst. In IOS we are able to detect when user take the screenshot using UIApplicationUserDidTakeScreenshotNotification. But in MACCatalyst it is not working. As per docs UIApplicationUserDidTakeScreenshotNotification and UIScreenCapturedDidChangeNotification are both supported for MacCatalyst 13.1+. But I am not getting screen shot notifications using both
2
0
101
5d
Fairplay error on MacOS catalyst
Hi, I have a IOS app and we are using fairplay DRM to play videos. In IOS app we are allowing offline download of the videos and hence we are getting a persistent fairplay license. In IOS app everything is working fine. Now we have used the same app and built for MacOS catalyst. In MAC OS catalyst app we are not able to play the video and getting error code -42650 We are able to get the persistent license from server, but when we play the video with the license we are getting the error. Below are the logs: 2024-12-06 22:05:48.911266+0530 0x4dffe2 Default 0x0 85505 0 teachonline: (MediaToolbox) [com.apple.coremedia:] &lt;&lt;&lt;&lt; FigPKDKeyManager &gt;&gt;&gt;&gt; keyManager_processOfflineKeyInternal: 0x600000322000 160D4519-C60B-4FD0-B69A-20B2A4597017 created decrypt context:0x0 with offline key; updated offline key:0x0 err:-42650 2024-12-06 22:05:48.911369+0530 0x4dffe2 Default 0x0 85505 0 teachonline: (MediaToolbox) [com.apple.coremedia:player] &lt;&lt;&lt;&lt; FigStreamPlayer &gt;&gt;&gt;&gt; fpfs_ensureDecryptorHasStarted: [0x7fc44e4dc520|P/NW] &lt;0x7fc44fa44000|I/SRA.01&gt;: track 1 latching decryptorFailure -42650 85505 0 teachonline: (MediaToolbox) [com.apple.coremedia:player] &lt;&lt;&lt;&lt; FigStreamPlayer &gt;&gt;&gt;&gt; fpfs_StopPlayingItem: [0x7fc44e4dc520|P/NW] &lt;0x7fc44fa44000|I/SRA.01&gt;: Pausing, err=Error Domain=CoreMediaErrorDomain Code=-42650 "(null)" I have copied only the lines which has errors. You can download the full logs from https://drive.google.com/file/d/1feb9pKZERUr--PMt6m-6IrO_mDvoFbjO/view?usp=sharing Can you please help me to fix the issue.
1
0
169
1w
Can I tell when my iOS Widget is running on MacOS (when Use IPhone Widgets is on)
I have an iOS Widget that also can load on the Mac when the Use iPhone Widgets setting is turned on on the Mac in Desktop & Dock. I want to use a different url scheme to open video clips from the widget if it is being clicked on iOS or the Mac. I tried using ProcessInfo.processInfo.isiOSAppOnMac but it always thinks it is on iOS. I also tried looking for the user document path to see if it was /var/mobile/ or /Users/. but it always thinks it is /var/mobile. I assume this is as it is not really a catalyst app but a WidgetKit extension from the phone. Is there anyway I can figure out when the widget is running on the mac? Thanks!
5
0
130
2w
Failure of AudioUnitSetProperty when using MacCatalyst (works on macOS)
I was trying to set custom audio output device for a generated audio on macCatalyst. While using let status = AudioUnitSetProperty(outputUnit, kAudioOutputUnitProperty_CurrentDevice, kAudioUnitScope_Global, 0, &outputDeviceID, UInt32(MemoryLayout.size)) kAudioOutputUnitProperty_CurrentDevice is invalid, and status = -10879, indicating an error. STEPS TO REPRODUCE Set Run Destination to MacOS and run the program. "AudioUnitSetProperty: 0" should be printed, indicating it works fine. Set Run Destination to Mac Catalyst and run the program. "Error setting output device: -10879" should be printed, indicating an error.
2
1
187
2w
How to run Catalyst xctest bundle with xcrun
I'm trying to run an xctest bundle, built for catalyst, with xcrun. i.e. xcrun xctest path_to_my_test.xctest It fails, complaining that: The bundle "MyBundle" couldn't be loaded because it is damaged or missing necessary resources. Try reinstalling the bundle.....but incompatible platform (have 'MacCatalyst', need 'macOS') So it seems like because I'm not executing it in a sim it wants the bundle to be a macOS bundle. But I would have thought it would be possible to run a Mac Catalyst target directly on a macOS host the same as a native macOS test target. Is this not possible?
0
0
111
3w
Does @available work on Mac Catalyst AppKit Bundle Plugin?
A Mac Catalyst App Creates an AppKit Bundle Plugin in which @available does not work。 In AppKit Bundle Plugin, there is not watchOS and iOS version can not be higher than 28, but the log has been output. if (@available(watchOS 18.0, *)) { NSLog(@"bundle is available watchOS"); } if (@available(iOS 28.0, *)) { NSLog(@"bundle is available iOS"); } demo link: https://pan.baidu.com/s/1s_5qmsL6Bh-df3A1PfD0OA Extracted code: 5ndj
3
0
140
2w
MacCatalyst - How to share Userdefaults between widget and app
Hi, Firstly: The whole question is about MacCatalyst (in IOS it works as intended) In my Maccatalyst app I want to share Userdefaults between app and widget. I have added an app group to the widget and the app and have set up Userdefauls accordingly. Here is the problem: Xcode claims that the app group should start with "group.***" because Catalyst is based on iOS. If I do so, my Catalyst app rises the "App wants to access data from other apps" requester on EVERY launch. So, I can't use it in production. Even if I would accept the requester, the widget isn't able to access the defaults at all because it does not rise that requester, but silently ignores the access. In contrast, if I setup the app group name with our TeamID (instead of group.*) then the requester vanishes, but Xcode does not accept it, issuing a warning and displaying the app group in red. I don't think this is advisable 'state' for production code. Even then widget can't see the data either. What is the recommended way of sharing Userdefaults between Catalyst app and Catalyst Widget (not the iOS widget which displays the "open on iPhone warning" when clicked) on macOS ? Thanks
3
0
253
Nov ’24
DocumentGroup opens an empty document on Mac Catalyst when the "Optimize for Mac" is checked
I am using a Mac Catalyst with SwiftUI for our document-based app with DocumentGroup. The issue is that when we create a new document or open an existing one, the opened view is completely blank. It is only blank/empty when the "Optimzie for Mac" is checked. If it is "Scaled t oMatch iPad", then it works well. Xcode 16.1 macOS 15.1 struct DocumentGroupTestApp: App { var body: some Scene { DocumentGroup(newDocument: WritingAppDocument()) { file in TestView() // it is empty when it gets opened. It does not work if the option "Optimize for Mac" is checked. If it is scale iPad, then it works. } } } struct TestView: View { var body: some View { Text("Hello, World!") } }
2
1
231
Nov ’24
Is there a way to opt a Catalyst app into supporting preferred text size?
As of macOS Sequoia 15.1 (and probably earlier), in System Settings under Accessibility -> Display, there's a Text Size option that looks an awful lot like Dynamic Type on iOS: I have an iOS app with robust support for Dynamic Type that I've brought to the Mac via Catalyst. Is there any way for me to opt this app into supporting this setting, maybe with some Info.plist key? Calendar's Info.plist has a CTIgnoreUserFonts value set to true, but the Info.plist for Notes has no such value.
0
0
202
Oct ’24
How can I make my multi-window Catalyst app restore window size and position after closing with stoplight button?
I have a Catalyst app that supports multiple scenes / windows. It has one "main" window type and lots of other secondary windows that can be opened. I'm using the system window restoration functionality via NSQuitAlwaysKeepsWindows to restore windows with their user activity data after the app is quit and restarted. Normally, this works great. If I open my app, change the size and position of my window, quit, and reopen it, the window size and position comes back as expected. But if I close the window using the red stoplight button and then click the app icon to bring it back, it comes back at the default position and size. This isn't how other system apps work - if I close the system Calendar app with the stoplight button, it comes back at the same size and position. How do I get this behavior with my Catalyst app? Is there some identifier property I need to set somewhere? I don't see such a property on UISceneConfiguration. If it matters, I'm using the configurationForConnectingSceneSession method to configure my windows when they open, instead of setting it up in the Info.plist.
1
0
285
Oct ’24
Required initializer unavailable in Mac Catalyst
Hello, I've just enabled Mac Catalyst for my already available and working iPad. When trying to build for Mac Catalyst I get this error in a subclass of NSURL. required initializer .... must be provided by subclass of NSURL Ok. So I add that, but then it tells me the Mac Catalyst doesn't support NSPasteboard. `NSPasteboard is unavailable in Mac Catalyst' This seems like a catch-22! I've tried variations like #if canImport(AppKit) && !targetEnvironment(macCatalyst) required init?(pasteboardPropertyList propertyList: Any, ofType type: NSPasteboard.PasteboardType) { fatalError("init(pasteboardPropertyList:ofType:) has not been implemented") } #endif But not having any luck.
0
0
229
Oct ’24
Weird vibrancy effects on Mac Catalyst
Hello, my app uses vibrancy effects thanks to SwiftUI's materials and hierarchical shape style. While they work flawlessly on iOS and iPadOS, on Mac Catalyst they seem to be pretty broken. I'm attaching some screenshots. iPad Mac This is the same code, with the same background behind the material. The colors are already pretty different, but my concern is about the text, which clearly looks broken Here a sample code: HStack(spacing: 0) { VStack(alignment: .leading, spacing: 2) { Text(event.label) .font(.subheadline.weight(.semibold)) .foregroundStyle(.secondary) Text(event.info(for: currentDestination)) .font(.system(.title2, design: .rounded, weight: .semibold)) .foregroundStyle(.primary) } Spacer(minLength: 0) InfoIcon(isCustom: event.isCustomIcon, icon: event.icon, renderingMode: .palette, size: iconSize) .font(.body.weight(.semibold)) } .padding(.horizontal, 24) .padding(.vertical, 12) .background(.quaternary, in: .rect(cornerRadius: 16, style: .continuous)) .clipShape(.rect(cornerRadius: 16, style: .continuous)) .padding(.all, 16) .background(.ultraThinMaterial, in: .rect)
0
0
206
Oct ’24