When a parent view is selected for the detail pane of a NavigationSplitView subviews appear as expected but not with the dimensions set by .frame on the subview.
Toggling the flag works as expected, appearing the subview with the idealWidth. I persist the flag in a SwiftData @Model class so that on restart and first appearance of the parent view the Right View subview presence is as it was left. The problem is that the .frame size is ignored, apparently. No manner of programatic view refresh seems to trigger a resize to the preferred values, only toggling the flag.
Is there a better way to handle a collapsing subview in an HSplitView? Why is the .frame not respected?
In this example I've added the else clause so HSplitView always has two views with .frame settings but the result is the same without it.
VStack {
HSplitView {
VStack {
Text("left view")
}
.frame(
minWidth: 100,
idealWidth: .infinity,
maxWidth: .infinity,
maxHeight: .infinity
)
if documentSettings.nwIsPieChartShowing {
VStack {
Text("right view")
}
.frame(
minWidth: 100,
idealWidth: 200,
maxWidth: .infinity,
maxHeight: .infinity
)
}
else {
Text("")
.frame(
minWidth: 0,
idealWidth: 0,
maxWidth: 0,
maxHeight: .infinity
)
}
}
HStack {
Button("Right View",
systemImage: { documentSettings.nwIsPieChartShowing ? "chart.pie.fill" : "chart.pie"}(),
action: { documentSettings.nwIsPieChartShowing.toggle() }
)
}
}
}
}
MacOS Sequoia 15.3.1, Xcode 16.2
Posts under macOS tag
200 Posts
Sort by:
Post
Replies
Boosts
Views
Activity
Hello I was wondering if there is a way to ensure that a C program I am writing can only write to 1 virtual page. I am trying to test how space efficient different Mallocs are and I need a way to ensure that the OS will not try to swap out pages making the space efficiency test pointless. I am on Mac OS Sonoma v14.5.
I am trying to install macOS Big Sur on my VM. It gets stuck on “About 14 minutes remaining ”Does anyone know how to get past it?
The application search for the occurences of a string into files and folders.
Everything work fine until I enable sanbox. Then opendir(path_to_folder) report "Operation not permitted".
By example dp = opendir("/Users/alain/Desktop"); set dp to NULL for my own Desktop.
The application need only read access. How can I get this access ?
For 9 Glorious Months, My MacBook Pro & J5 Create JCD543 HUB Were Best Friends… Until I Updated macOS
For nearly a year, my MacBook Pro 14” (2023, M2 Pro, 16GB RAM) worked flawlessly with my J5 Create JCD543 HUB, allowing me to run:
✅ 4 External Displays (Samsung, LG, Insignia, Samsung)
A setup that worked perfectly… until I updated macOS.
Then Came the Update… and the Issues Began
First, I updated last week. Two of my four displays stopped working. No big deal, I thought—I’ve dealt with display quirks before.
Then, like an optimist ignoring red flags, I updated again last night to 15.4 Beta (24E5222f) and… well, now things are completely broken.
My Once-Perfect Setup (Now a Display Disaster)
JCD543 HUB → 2 HDMI displays (not working)
JUD380 HUB → 1 HDMI display (partially working, unstable)
MacBook HDMI port → 1 HDMI display (working, but feeling abandoned)
JCA365 USB-C to Dual HDMI Adapter (Not part of my setup, but tested—also not working)
What I’ve Tried (aka My Troubleshooting Journey)
✔ Restarted my Mac multiple times
✔ Uninstalled and reinstalled J5 drivers
✔ Swapped cables, unplugged/replugged everything, tested known-working HDMI cables (they work fine on other devices)
✔ Deleted /Library/Preferences/com.apple.windowserver.displays.plist (this fixed a similar issue in the past, but the file no longer exists in this update)
The Likely Culprit?
It seems to be a J5 driver issue triggered by the macOS update—and I’m not alone. Others are reporting similar problems.
Apple… Any Fixes?
I just want my four screens back. The setup worked flawlessly for 9 months, so it’s hard to believe it was never meant to work.
If anyone has a workaround, I’m open to testing any solution—whether it’s a driver update, system tweak, or hidden macOS setting that might bring my displays back to life.
Any advice would be greatly appreciated! Thanks in advance.
(P.S. Apple, if you’re reading this—please look into this issue!)
On macOS 15.4 beta 2 (24E5222f), the back button is not visible when navigating from a view with no toolbar to a view with a toolbar button. The back button is visible on macOS 15.3.1 and earlier versions.
Also, the toolbar button shown when run on macOS 15.4 beta 2 is truncated.
This is how it looks on macOS 15.4 beta 2:
And this is how it looks on macOS 15.3.1 and earlier:
Feedback ID: FB16743834
We are building a 'server' application that can either run as a daemon or can run in background without showing any GUI. Basically, the end user can either configure this to run as a daemon so that it can be tied to the user's session or will launch the process which user will start and quit as needed.
I wanted to understand what is the recommended mechanism for such an application from Apple -
Should this application be built as a macOS Bundle ? Apple documentation also says that we should not daemonize the process by calling fork. Hence if we create a unix-style executable, will I not need to fork to make it run in a detached state when I launch the executable via double-click ? [Reference Link]
Is it fine to have an application on macOS which is a bundle but does not show any UI when launched by double click on the app-icon or via 'open'? While we have been able to achieve this by using NSApplicationMain and not showing the UI, was wondering if using CFRunLoop is best for this case as it is a non-gui application.
If we can get the right documentation link or recommendations on how we should build such an application which can run in a non-gui mode and also in a daemonized manner, it will help us.
Should the application be always built as a macos bundle or should it be a unix-style executable to support both the cases - by the same application/product and how should we look at the distribution of such applications.
I’m attempting to make an app that uses Disk Arbitration to intercept a disk mount (by creating and returning a dissenter in the appropriate callback) and then mount the disk with certain options (specifically, read-only, nobrowse, or both, depending on user options). For example:
DADiskMountWithArguments(disk, nil, DADiskMountOptions(kDADiskMountOptionDefault), nil, nil, kReadOnly)
…where kReadOnly is a pointer to an array only containing a “rdonly” CFString.
While DADiskMountWithArguments seems to be usable in a sandboxed app for disk images, it doesn’t work when the disk is an external disk (e.g. connected via USB). I see lines like this in Console.app when this happens:
Sandbox denied authorizing right 'system.volume.external.mount' by client '/path/to/exe' [17934] (engine 580)
I’ve identified two workarounds that allow this to work in a sandbox, but both have their own problems:
If a LaunchDaemon (even a sandboxed one, which is required for registration with SMAppService.daemon from the sandboxed app) does the call to DADiskMountWithArguments, it will succeed. But App Store policies don’t allow escalation to root.
If I use the undocumented entitlement com.apple.security.temporary-exception.sbpl with a value of (allow authorization-right-obtain (right-name "system.volume.external.mount")), the mount works without escalation to root. But I understand that App Review is likely to reject the use of this entitlement, and that this entitlement isn't supported to begin with.
Specifically, these are the behaviors I see on macOS Sequoia 15.3.1 and Xcode 16.2.
Since I would like to try to publish this app on the App Store, neither of these seem like acceptable solutions.
I don’t see why this should be restricted if the sandboxed app is not declaring a special path (i.e. the path in DADiskMountWithArguments is set to nil) and still does not have access to the mounted filesystem - am I missing something/is there a way to accomplish this?
Topic:
App & System Services
SubTopic:
Core OS
Tags:
Entitlements
macOS
App Sandbox
Disk Arbitration
When our content filter is deployed, some customers report issues which show that the content filter activation was performed but the filter is showing the state [activated waiting for user].
This typically happens if the customer isn't deploying a profile to pre-authorise the system extension.
The customers report that there was no popup shown for them to allow the filter to complete activation.
Once the filter is in this state, there doesn't seem to be a way to clear it without resorting to disabling SIP.
Attempting a deactivation does not work, the filter remains in the same state.
Is there a way we can we resolve this "stuck" state when it happens without disabling SIP?
Hello,
We're attempting to validate our application archive through Xcode but the application is crashing during the validate step and we're not sure why.
Platform: macOS 15.1
Arch: arm64
We've confirmed that our developer agreements are up to date (a suggestion made by other posts on these forums). Other suggestions have been to downgrade Xcode but we're hoping there's another explanation.
The application is quite complex - many libraries and framework - but executes as expected during development and testing.
Crash Report
Any insight into this error would be appreciated. We're sure it's something wrong with our plist or archive structure but the crash is limiting our ability to debug.
I found the Table with Toggle will have performance issue when the data is large.
I can reproduce it in Apple demo:
https://developer.apple.com/documentation/swiftui/building_a_great_mac_app_with_swiftui
Replace with a large mock data, for example
database.json
Try to scroll the table, it's not smooth.
I found if I delete the Toggle, the performance be good.
TableColumn("Favorite", value: \.favorite, comparator: BoolComparator()) { plant in
Toggle("Favorite", isOn: $garden[plant.id].favorite)
.labelsHidden()
}
Is this bug in SwiftUI? Any workaround?
My Mac is Intel, not sure it can repro on Apple Silicon
On my macOS 15.x device, frequently encountering the error:
Error Domain=com.apple.wifi.apple80211API.error Code=-528342014 "tmpErr"
when connecting to an EAP WiFi network using CWWiFiClient. Restarting the device temporarily resolves the issue, but it reoccurs after some time.
What could be causing this, and how can it be resolved programmatically?
Consider this code:
import SwiftUI
struct ContentView: View {
var body: some View {
NavigationView {
EmptyView()
}
}
}
Which looks like this:
How can I prevent the sidebar from being resized by a mouse and from being hidden?
P.S. Can consider using AppKit if it can help.
How can I put one list item at the top and another one at the bottom, retaining the NavigationView functionality?
Here is a simple app:
struct ContentView: View {
var body: some View {
NavigationView {
Sidebar()
}
}
}
struct Sidebar: View {
@State private var isActive = true
var body: some View {
List {
NavigationLink(isActive: $isActive) {
HomeView()
} label: {
Text("Home")
}
NavigationLink {
SettingsView()
} label: {
Text("Settings")
}
}
}
}
struct HomeView: View {
var body: some View {
VStack {}
.navigationTitle("Home")
}
}
struct SettingsView: View {
var body: some View {
VStack {}
.navigationTitle("Settings")
}
}
Which looks like this:
My initial though was to put a Spacer() between each NavigationLink, but it results in an unexpected view:
What i can do:
Place an empty VStack between each NavigationLink with a hard-coded height like this:
VStack {}.frame(height: 275)
Which looks like this:
But it wouldn't work if a user would want to increase the height of a window.
I could disable window resizing which is kind of fine, but not the most optimal.
Another obvious option was to replace the List with a VStack, but with this approach the styling of the NavigationLink gets broken and it does not get highlighted when I click on it.
It looks like this:
P.S. I know that NavigationView is deprecated, but i want to support macOS 12.0.
Hi, I accidentally downloaded a disk image and tried to run it, I shortly realized that it is probably malware. I'm worried that there's malware on my computer but I'm unsure if Gatekeeper was able to block me from running the image. I believe I clicked "Open anyway" or something along those lines even after it said not to run it, so I'm pretty scared that it was able to run. I checked the logs for Gatekeeper, and I see that it says "Code did not match any currently allowed policy". Does this mean it blocked whatever disk image I mistakenly tried to run? Thank you so much for your answers, it will help me stop worrying.
2025-03-01 10:45:10.480495-0800 0x953f85 Default 0x0 301 0 syspolicyd: [com.apple.syspolicy.exec:default] Fast Gatekeeper overrides are: inactive
2025-03-01 10:45:14.308061-0800 0x95412e Default 0x0 301 0 syspolicyd: [com.apple.syspolicy.exec:default] Caller indicated a Gatekeeper override occurred: <private>
2025-03-01 10:45:14.314205-0800 0x95412c Default 0x0 39200 2 CoreServicesUIAgent: [com.apple.launchservices:uiagent] Cleared Gatekeeper rejection record sucessfully
2025-03-01 10:45:25.864198-0800 0x953f85 Error 0x0 301 0 syspolicyd: [com.apple.syspolicy.exec:default] Error Domain=GatekeeperPolicyScanError Code=-67018 "Code did not match any currently allowed policy" UserInfo={NSURL=<private>, NSLocalizedDescription=Code did not match any currently allowed policy}
2025-03-01 10:45:30.659323-0800 0x95430b Default 0x0 301 0 syspolicyd: [com.apple.syspolicy.exec:default] Adding Gatekeeper denial breadcrumb (direct): PST: (path: 5451bc9511ea5cc0), (team: (null)), (id: project-55554944375cf61a58343acb828244228823e532), (bundle_id: NOT_A_BUNDLE)
2025-03-01 10:45:30.662733-0800 0x95430b Error 0x0 301 0 syspolicyd: [com.apple.syspolicy.exec:default] Terminating process due to Gatekeeper rejection: 39389, <private>
2025-03-01 10:45:54.602124-0800 0x9545ed Default 0x0 301 0 syspolicyd: [com.apple.syspolicy.exec:default] Fast Gatekeeper overrides are: inactive
2025-03-01 10:46:35.578533-0800 0x9548b4 Default 0x0 301 0 syspolicyd: [com.apple.syspolicy.exec:default] Fast Gatekeeper overrides are: inactive
2025-03-01 10:46:37.719530-0800 0x9533cf Default 0x0 39200 2 CoreServicesUIAgent: [com.apple.launchservices:uiagent] Cleared Gatekeeper rejection record sucessfully
I'd like to write an app to help diagnose malfunctioning home theater setups.
I've seen libcec, but it doesn't seem to support Apple's HDMI ports (and maybe APIs to support it don't exist? I'm not sure.)
Thanks in advance. Sorry if I've applied the wrong tags to this post.
So far, we have been using Google Maps to determine distance along a certain route for a MacOS app to register kilometers for a business administration app. But, this is no longer possible, as the login for google maps no longer works. I understand we would have to pay to continue using the Google Maps service as it was and we would have to make changes to the app. That would be ok, but I was just wondering does any developer on this forum have suggestions on how to resolve this issue? Or even maybe have suggestions, to make this work better than before. Three suggestions by chatgpt: use ANWB route planner using google maps, Pro6pp, or to useWisp.Software (something I haven't heard of before. Your suggestions and ideas are welcome. Also, if the Apple Developer team knows of a way how to do this in your app, your advice is more than welcome. Have a nice day!
Topic:
Developer Tools & Services
SubTopic:
Apple Developer Program
Tags:
Nearby Interaction
macOS
MapKit JS
Core Location
on iOS you can choose to scale to view to have the app resize the screen easily in the developer environment. Scale to view is however not easily done on MacOS using NS to solve on MacOS now. Is it possible for the Apple developer team to make this easier for the Developer, as I understand it is for iOS applications?
I am looking for inputs to better understand MacOS entitlements. I ask this in context of OpenJDK project, which builds and ships the JDK. The build process makes uses of make tool and thus doesn't involving building through the XCode product. The JDK itself is a Java language platform providing applications a set of standard APIs. The implementation of these standard APIs internally involves calling platform specific native library functions. In this discussion, I would like to focus on the networking functions that the implementation uses. Almost all of these networking functions and syscalls that the internal implementation uses are BSD socket related. Imagine calls to socket(), connect(), getsockopt(), setsockopt(), getaddrinfo(), sendto(), listen(), accept() and several such.
The JDK that's built through make is then packaged and made available for installation. The packaging itself varies, but for this discussion, I'll focus on the .tar.gz archived packaging. Within this archive there are several executables (for example: java, javac and others) and several libraries. My understanding, based on what I have read of MacOS entitlements is that, the entitlements are set on the executable and any libraries that would be loaded and used by that executable will be evaluated against the entitlements of the executable (please correct me if I misunderstand).
Reading through the list of entitlements noted here https://developer.apple.com/documentation/bundleresources/entitlements, the relevant entitlements that an executable (like "java") which internally invokes BSD socket related syscalls and library functions, appear to be:
com.apple.security.network.client - https://developer.apple.com/documentation/bundleresources/entitlements/com.apple.security.network.client
com.apple.security.network.server - https://developer.apple.com/documentation/bundleresources/entitlements/com.apple.security.network.server
com.apple.developer.networking.multicast - https://developer.apple.com/documentation/bundleresources/entitlements/com.apple.developer.networking.multicast
Is my understanding correct that these are the relevant ones for MacOS? Are there any more entitlements that are of interest? Would it then mean that the executables (java for example) would have to enroll for these entitlements to be allowed to invoke those functions at runtime?
Reading through https://developer.apple.com/documentation/bundleresources/entitlements, I believe that even when an executable is configured with these entitlements, when the application is running if that executable makes use of any operations for which it has an entitlement, the user is still prompted (through a UI notification) whether or not to allow the operation. Did I understand it right?
The part that isn't clear from that documentation is, if the executable hasn't been configured with a relevant entitlement, what happens when the executable invokes on such operation. Will the user see a UI notification asking permission to allow the operation (just like if an entitlement was configured)? Or does that operation just fail in some behind the scenes way?
Coming back to the networking specific entitlements, I found a couple of places in the MacOS documentation where it is claimed that the com.apple.developer.networking.multicast entitlement is only applicable on iOS. In fact, the entitlement definition page for it https://developer.apple.com/documentation/bundleresources/entitlements/com.apple.developer.networking.multicast says:
"Your app must have this entitlement to send or receive IP multicast or broadcast on iOS. It also allows your app to browse and advertise arbitrary Bonjour service types."
Yet, that same page, a few lines above, shows "macOS 10.0+". So, is com.apple.developer.networking.multicast entitlement necessary for an executable running on MacOS which deals with multicasting using BSD sockets?
As a more general comment about the documentation, I see that the main entitlements page here https://developer.apple.com/documentation/bundleresources/entitlements categorizes some of these entitlements under specific categories, for example, notice how some entitlements are categorized under "App Clips". I think it would be useful if there was a category for "BSD sockets" and under that it would list all relevant entitlements that are applicable, even if it means repeating the entitlement names across different categories. I think that will make it easier to identify the relevant entitlements.
Finally, more as a long term question, how does one watch or keep track of these required entitlements for these operations. What I mean is, is it expected that application developers keep visiting the macos documentation, like these pages, to know that a new entitlement is now required in a new macos (update) release? Or are there other ways to keep track of it? For example, if a newer macos requires a new entitlement, then when (an already built) executable is run on that version of macos, perhaps generate a notification or some kind of explicit error which makes it clear what entitlement is missing? I have read through https://developer.apple.com/documentation/bundleresources/diagnosing-issues-with-entitlements but that page focuses on identifying such issues when a executable is being built and doesn't explain the case where an executable has already been shipped with X entitlements and a new Y entitlement is now required to run on a newer version of macos.
I am currently developing a No-Sandbox application.
What I want to achieve is to use AuthorizationCopyRights in a No-Sandbox application to elevate to root, then register SMAppService.daemon after elevation, and finally call the registered daemon from within the No-Sandbox application.
Implementation Details
Here is the Plist that I am registering with SMAppService:
<?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>Label</key>
<string>com.example.agent</string>
<key>BundleProgram</key>
<string>/usr/local/bin/test</string>
<key>ProgramArguments</key>
<array>
<string>/usr/local/bin/test</string>
<string>login</string>
</array>
<key>RunAtLoad</key>
<true/>
</dict>
</plist>
Code that successfully performs privilege escalation (a helper tool popup appears)
private func registerSMAppServiceDaemon() -> Bool {
let service = SMAppService.daemon(plistName: "com.example.plist")
do {
try service.register()
print("Successfully registered \(service)")
return true
} catch {
print("Unable to register \(error)")
return false
}
}
private func levelUpRoot() -> Bool {
var authRef: AuthorizationRef?
let status = AuthorizationCreate(nil, nil, [], &authRef)
if status != errAuthorizationSuccess {
return false
}
let rightName = kSMRightBlessPrivilegedHelper
return rightName.withCString { cStringName -> Bool in
var authItem = AuthorizationItem(
name: cStringName,
valueLength: 0,
value: nil,
flags: 0
)
return withUnsafeMutablePointer(to: &authItem) { authItemPointer -> Bool in
var authRights = AuthorizationRights(count: 1, items: authItemPointer)
let authFlags: AuthorizationFlags = [.interactionAllowed, .preAuthorize, .extendRights]
let status = AuthorizationCopyRights(authRef!, &authRights, nil, authFlags, nil)
if status == errAuthorizationSuccess {
if !registerSMAppServiceDaemon() {
return false
}
return true
}
return false
}
}
}
Error Details
Unable to register Error Domain=SMAppServiceErrorDomain Code=1 "Operation not permitted" UserInfo={NSLocalizedFailureReason=Operation not permitted}
The likely cause of this error is that /usr/local/bin/test is being bundled.
However, based on my understanding, since this is a non-sandboxed application, the binary should be accessible as long as it is run as root.
Trying
post as mentioned in the response, placing the test binary under Contents/Resources/ allows SMAppService to successfully register it. However, executing the binary results in a different error.
Here is the plist at that time.
<?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>Label</key>
<string>com.example.agent</string>
<key>BundleProgram</key>
<string>Contents/Resources/test</string>
<key>ProgramArguments</key>
<array>
<string>Contents/Resources/test</string>
<string>login</string>
</array>
<key>RunAtLoad</key>
<true/>
</dict>
</plist>
Here is the function at that time.
private func executeBin() {
let bundle = Bundle.main
if let binaryPath = bundle.path(forResource: "test", ofType: nil) {
print(binaryPath)
let task = Process()
task.executableURL = URL(fileURLWithPath: binaryPath)
task.arguments = ["login"]
let pipe = Pipe()
task.standardOutput = pipe
task.standardError = pipe
do {
try task.run()
let outputData = pipe.fileHandleForReading.readDataToEndOfFile()
if let output = String(data: outputData, encoding: .utf8) {
print("Binary output: \(output)")
}
task.waitUntilExit()
if task.terminationStatus == 0 {
print("Binary executed successfully")
} else {
print("Binary execution failed with status: \(task.terminationStatus)")
}
} catch {
print("Error executing binary: \(error)")
}
} else {
print("Binary not found in the app bundle")
}
}
Executed After Error
Binary output:
Binary execution failed with status: 5
Are there any other ways to execute a specific binary as root when using AuthorizationCopyRights?
For example, by preparing a Helper Tool?