I'm running into a change in behavior with the title bar when building our Catalyst app under Xcode 16 versus what we are seeing with the same code built under Xcode 15.
The title bar is hidden, as it should be in the Xcode 15 build. However, when building the same project under Xcode 16, the title bar is shown with the center contents of the navigation bar in the right pane being duplicated in the title bar (see screenshot at the end), which is undesirable.
The screenshots for both builds were taken in macOS Sequoia Beta Seed 1. The Catalyst Interface setting is configured to "Optimize for Mac" in the project file.
The scene's titlebar.titleVisibility property is set to .hidden, titlebar.toolbar is set to nil. UINavigationBar's appearance is configured with a preferredBehaviorStyle of .pad when running under Catalyst 16 or later.
Is this a bug or am I missing a flag or something that was introduced to Catalyst/UIKit that I've overlooked? I've also filed a feedback for this issue: FB14000006.
Thank you for your time.
Mac Catalyst
RSS for tagStart building a native Mac app from your current iPad app using Mac Catalyst.
Posts under Mac Catalyst tag
113 Posts
Sort by:
Post
Replies
Boosts
Views
Activity
I currently have a universal app that uses MacCatalyst. I want to update the Mac app to use "Designed for iPad". I know Intel Macs won't be able to download the updated version, but will current Intel app users be able to restore the download version they had, (ie. a clean os install)? Will new intel users be able to download the previous catalyst version, or is it removed from the store completely?
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?
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.
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!
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?
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.
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
I am using a Mac Catalyst app and saving the content of the app in core data.
After uninstalling the app the saved core data file is not getting deleted. Due to this I am having major bugs during launch of the app.
My requirement is core data contents should be removed once the app is uninstalled.
Anybody with solutions for this?
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?
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?
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
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
}
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.
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
Hey, I am trying to use Family Controls in Mac Catalyst. On the iOS app it works fine. On macOs using Mac Catalyst it builds fine but I get following console output.
Failed to get service proxy: Error Domain=NSCocoaErrorDomain Code=4099 "The connection to service named com.apple.FamilyControlsAgent was invalidated: failed at lookup with error 159 - Sandbox restriction." UserInfo={NSDebugDescription=The connection to service named com.apple.FamilyControlsAgent was invalidated: failed at lookup with error 159 - Sandbox restriction.}`
When i try to open the FamilyActivityPicker on the macOs app following error is displayed in the GUI.
The operation could not be completed. (FamilyControls.ActivityPickerRemoteView Error error 2.)
Do I need a familyControls capability for macOs? If yes, I only find it for iOS.
Thanks for hints and help :)
Starting with the macOS version 14.x.x and TextKit1, selecting multiple lines of text triggers a text replacement bug: some of the text on one of the selected lines inadvertently replaces a portion of the selected text.
For example, the bug is exhibited when selecting the following lines:
Carnaroli, Maratelli, or Vialone Nano are best
Vialone Nano cooks quickly – watch it! It also absorbs condiments nicely.
Avoid Baldo, Originario, Ribe and Roma
To trigger the bug, select the three line paragraph using either the cursor or shift with arrow keys. Notice that a portion of the selected text was replaced. Command-Z to undo will allow you to repeat the undesired behavior.
In this case, "e Nano cooks quickly - " is replaced by "Baldo, Originario, Ribe."
This does not occur with all strings or selected strings, but in cases where it does occur, it is perfectly reproducible. It does not occur on iOS. Pasteboard contents are irrelevant. After triggering the bug repeatedly, at some point it stops occurring.
Why does this bug occur? How can it be fixed?
Here is some sample code to reproduce the issue.
@end
@implementation TestNoteViewController
- (void)viewDidLoad {
[super viewDidLoad];
[self createTextView];
}
- (void)createTextView {
NSAttributedString *attrString = [[NSAttributedString alloc] initWithString:self.note.text
attributes:nil];
NSTextStorage *textStorage = [NSTextStorage new];
[textStorage appendAttributedString:attrString];
CGRect newTextViewRect = self.view.bounds;
// Create the layout manager
NSLayoutManager *layoutManager = [NSLayoutManager new];
[textStorage addLayoutManager:layoutManager];
// Create a text container
NSTextContainer *container = [[NSTextContainer alloc] initWithSize:CGSizeMake(newTextViewRect.size.width, CGFLOAT_MAX)];
[layoutManager addTextContainer:container];
// Create and place a text view
UITextView *textView = [[UITextView alloc] initWithFrame:newTextViewRect
textContainer:container];
[self.view addSubview:textView];
textView.translatesAutoresizingMaskIntoConstraints = NO;
UILayoutGuide *safeArea = textView.superview.safeAreaLayoutGuide;
[textView.leadingAnchor constraintEqualToAnchor:safeArea.leadingAnchor].active = YES;
[textView.trailingAnchor constraintEqualToAnchor:safeArea.trailingAnchor].active = YES;
[textView.topAnchor constraintEqualToAnchor:safeArea.topAnchor].active = YES;
[textView.bottomAnchor constraintEqualToAnchor:textView.superview.bottomAnchor].active = YES;
}
@end
For some reason, I have to build my iOS app project on target My Mac(Designed for iPhone) instead of using Mac Catalyst.
Now I want to access these window buttons, is there any possible way to do that? or print current view/components whatever it is while clicking button?
Hello,
We've an iOS application that can be launched on macOS (with the "designed for iPhone" available with Catalyst).
This application request authorization on MPMediaLibrary and play MPMediaItem with an audio player. After accepted, the authorization status is well flagged as .authorized
I can browse all MPMediaItem without issue and display them in my app.
But, when it comes the time to convert the MPMediaItem file's URL in AVAudioFile with:
AVAudioFile(forReading: fileURL)
We got 2 warnings in the console:
ExtAudioFile.cpp:211 about to throw -54: open audio file
AVAEInternal.h:109 [AVAudioFile.mm:135:AVAudioFileImpl: (ExtAudioFileOpenURL((CFURLRef)fileURL, &_extAudioFile)): error -54
We finally get an exception with this error:
Error Domain=com.apple.coreaudio.avfaudio Code=-54 "(null)" UserInfo={failed call=ExtAudioFileOpenURL((CFURLRef)fileURL, &_extAudioFile)}
This working perfectly on iOS and iPadOS, but with Catalyst we always got this error whatever the audio (from iTunes library) we try to play.
Why do we have this permission issue only on macOS ? There is something different to do to get permission on macOS ?
thanks !
I recently updated to macOS Sonoma 14.4 and now UIDevice.current.batteryLevel is always 0.
Code to reproduce:
import SwiftUI
struct ContentView: View {
@State
private var monitoringEnabled = UIDevice.current.isBatteryMonitoringEnabled;
@State
private var batteryLevel = UIDevice.current.batteryLevel;
var body: some View {
VStack {
Text("Battery Monitoring Enabled: " + String(monitoringEnabled))
Text("Battery Level: " + String(batteryLevel))
Button("Toggle Monitoring") {
monitoringEnabled = !monitoringEnabled;
UIDevice.current.isBatteryMonitoringEnabled = monitoringEnabled;
batteryLevel = UIDevice.current.batteryLevel;
}
}
.padding()
}
}
Run the above on a macOS 14.4 target, click "Toggle Monitoring", and you'll see battery level is reported as 0:
I also see the following error in my app logs when running on macOS 14.4:
Error retrieving battery status: result=-536870207 percent=0 hasExternalConnected=1 isCharging=0 isFullyCharged=0
This code displays the expected battery level when running on an actual iOS device: