macOS is the operating system for Mac.

Posts under macOS tag

200 Posts

Post

Replies

Boosts

Views

Activity

NSHostingSceneRepresentation doesn't show Window(_:id:) and UtilityWindow(_:id:) with .openWIndow(id:)
NSHostingSceneRepresentation, introduced in macOS 26, allows calling SwiftUI’s windows and other elements set in a Scene from AppKit. However, while Settings and WindowGroup set in the Scene can be invoked as expected using environment.openSettings() and environment.openWindow(id:) respectively, calling Window or WindowUtility doesn’t work. That is, the app just fails to open the desired window with the provided ID, and no error message or other feedback/crash/freeze appears. I expect that executing the openUtilityWindow(_:)action in the following code will display the UtilityWindow set in the scene. However, the window does not actually open. @main final class AppDelegate: NSObject, NSApplicationDelegate { private let scene = NSHostingSceneRepresentation { UtilityWindow("Utility Window", id: "UtilityWindow") { Text("Utility Window") .scenePadding() } } func applicationWillFinishLaunching(_ notification: Notification) { NSApp.addSceneRepresentation(self.scene) } @IBAction func openUtilityWindow(_ sender: Any?) { self.scene.environment.openWindow(id: "UtilityWindow") } } Is there something wrong with my implementation and expectation? Or is this a bug in NSHostingSceneRepresentation? Just in case, I’ve already filed this issue withFeedback Assistant: FB20310722 This feedback also includes a sample project reproducing this issue.
1
1
116
1w
Does Mac Catalyst support an "always on top" window scene?
My UIKit/Mac Catalyst app supports a user opening multiple windows (multiple scenes). One of these is a special scene that shows content that I want to appear in front of all other app windows/scenes, even while the user is interacting with one of the app's other scenes. I do not need this special scene to stay in front of the windows of other apps, just in front of the windows of my own app. While I'm not 100% sure, it seems that AppKit supports this through the NSWindow level property. I can't find any equivalent feature in UIKit/Mac Catalyst. UIWindow windowLevel is not the same thing since that only affects the order of windows within a given scene. I need an entire scene (and its windows) to stay in front of my app's other scenes (and their windows). I don't see anything relevant in UIWindow, UIScene, UIWindowScene, UISceneSession, UIScene.ActivationRequestOptions, or UIWindowScene.ActivationRequestOptions.
2
0
78
1w
macOS Tahoe: Can't setup AVAudioEngine with playthrough
Hi, I'm trying to setup a AVAudioEngine for USB Audio recording and monitoring playthrough. As soon as I try to setup playthough I get an error in the console: AVAEInternal.h:83 required condition is false: [AVAudioEngineGraph.mm:1361:Initialize: (IsFormatSampleRateAndChannelCountValid(outputHWFormat))] Any ideas how to fix it? // Input-Device setzen try? setupInputDevice(deviceID: inputDevice) let input = audioEngine.inputNode // Stereo-Format erzwingen let inputHWFormat = input.inputFormat(forBus: 0) let stereoFormat = AVAudioFormat(commonFormat: inputHWFormat.commonFormat, sampleRate: inputHWFormat.sampleRate, channels: 2, interleaved: inputHWFormat.isInterleaved) guard let format = stereoFormat else { throw AudioError.deviceSetupFailed(-1) } print("Input format: \(inputHWFormat)") print("Forced stereo format: \(format)") audioEngine.attach(monitorMixer) audioEngine.connect(input, to: monitorMixer, format: format) // MonitorMixer -> MainMixer (Output) // Problem here, format: format also breaks. audioEngine.connect(monitorMixer, to: audioEngine.mainMixerNode, format: nil)
0
0
116
1w
Shared modelContainer between DocumentGroup and WindowGroup
Hi, I am currently developing a document-based application with additional WindowGroup for macOS and have encountered a challenge related to document container management. Specifically, I need to open a windowGroup that shares the same container as the one used in the DocumentGroup. However, my current approach of using a global shared model container has led to unintended behavior: any new document created is linked to existing ones, and changes made in one document are reflected across all documents. To address this issue, I am looking for a solution that allows each newly created document to be individualized while still sharing the document container with all relevant WindowGroups that require access to the data it holds. I would greatly appreciate any insights or recommendations you might have on how to achieve this. struct Todo: App { var body: some Scene { DocumentGroup(editing: Item.self, contentType: .item) { ContentView() } WindowGroup(for: Item.self) { $item in ItemView(item:$item) .modelContainer(Of DocumentGroup above) } } } Thank you for your time and assistance. Best regards,
1
1
111
1w
Roblox freezing on MacOS 26.1 Beta
After updating to MacOS 26.1 I encountered an issue that Roblox tends to freeze quite often for 10 - 60 seconds at most, this is really annoying that it is doing this as i play the game a lot. My theory is that it is like a driver issue with metal or something, I have reinstalled MacOS, reinstalled the game and lowed the performance manually but nothing is working. Wondering if you could help, when it will be fixed and if others are having the same issue. Many thanks, William.
4
2
666
1w
Xcode 26 on macOS 26 with a Dark theme in Light Mode
Is anyone else using one of the "Dark" editor themes (such as "Default (Dark)" or "Classic (Dark)" in Xcode? And is anyone doing this with Xcode 26 on macOS 26? Here's the result while using the "Default (Dark)" theme while my Mac is in "light" mode: Note that the black background of the editor goes all the way to the far left edge of the Xcode window. The large gray area in the project tree is the black background bleeding through the sidebar. This is really distracting. Is there a way to fix this (besides not using a dark theme - I've been using dark themes for over 30 years)? This appears to be a poor design decision in macOS 26 to have split views show the background of the secondary column behind the primary column. iPadOS 26 has the same issue (see https://developer.apple.com/forums/thread/800073).
0
0
75
1w
[macOS] CoreSpotlight importer using CSImportExtension failing to index
I've been trying to add a CoreSpotlight indexer to my macOS application. The new template for the indexer uses the new appex CSImportExtension style importer. I've been following this -> https://developer.apple.com/documentation/corespotlight/csimportextension I changed the CSSupportedContentTypes in the Info.plist file to the correct file type uti. I added a dummy value into the attributes (see code below) - just setting contentDescription to 'noodle' (easy to search for) class ImportExtension: CSImportExtension {   override func update(_ attributes: CSSearchableItemAttributeSet, forFileAt: URL) throws {     // Add a dummy value, and see whether spotlight finds it     attributes.contentDescription = "noodle" } } I have a number of files on disk that match the uti (and can be found when I search by the file name) Yet, when I build and run my app, the a spotlight search for 'noodle' finds no results. Can anyone give me any advice? I cannot find any indication that the ImportExtension is called (although when I put a log message at the start of the update() call there's no message in the console which seems to suggest it's not being called). Is there any way of debugging this? Cheers and thanks -- Darren.
9
0
2.2k
2w
SwiftUI Controls Documentation
Hi, I am looking for comprehensive "controls" documentation for SwiftUI. When searching on the Apple site, I have not seen any documentation that shows a picture of a control and an explantation of what it does, for all the available controls. I have also searched the web for such documentation, and have not found any. When I was learning Rust, I came across a beautiful document about GTK3 (PDF) that had a complete list of controls, including pictures. If something looked interesting I could do a search for more details. Thanks, Jim
1
0
128
2w
How to apply SwiftUI window modifiers when using Xcode's #Preview on a macOS view?
Is there a way to configure the style and toolbar of the macOS window that Xcode uses in #Preview? I am working on a macOS application and want to preview some SwiftUI views within different window styles, toolbar styles and window title/subtitle visibilities. Some of the modifiers to control the look-and-feel of a window are actually Scene Modifiers, not View Modifiers: .windowStyle .windowToolbarLabelStyle .windowToolbarStyle But #Preview does not accept Scenes, so I can't apply these modifiers: // Error, not a view modifier. #Preview { ContentView() .windowStyle(...) } // Error, Window is not supported in #Preview. #Preview { Window("Browser", id: "browser") { ContentView() } } If I give my ContentView a .toolbar(...), Xcode's Preview will correctly show a window with a toolbar, but not necessarily in the style I want. Is there a way to apply the Scene Modifiers to #Preview so that I can see how they affect the window's chrome and toolbar?
Topic: UI Frameworks SubTopic: SwiftUI Tags:
0
0
41
2w
codesign not signing .app MacOS executable 'can't verify signature'
I am facing an issue while codesigning the Content/MacOS executable. The executable name is exactly similar to the .app file, and the signing certificates have not expired yet. Steps followed to generate signed files: Executed codesign on files within the .app folder. Then executed codesign on the .app folder. Tried to notarize with the new notarization tool. Do we have to sign each individual file and folder? Observations: .DS_Store files were removed from the .app before signing. Another app with the same certificate is able to sign correctly. Content/MacOS contains multiple files, including the app executable. These files are signed except the main executable. same installed_app after copying at another location showing signed. Getting: App Sandbox-Not enabled Hardening-Enabled - Version 10.9.0 Notarization-Granted Gatekeeper-Can't evaluate Signed By- Can't verify signature
3
0
768
2w
APNS Notifications not received on macOS Device
Hello Team, We are currently experiencing an issue where some of our devices are not receiving push notifications. We are sending notifications via the Apple Push Notification portal (https://developer.apple.com/notifications/push-notifications-console/) using the following two requests. However, in both cases, the notifications are not being delivered to the devices. Scenario 1 : When we send a request with apns-push-type set to alert, we receive the following error. Request : curl -v --header "authorization: bearer ${AUTHENTICATION_TOKEN}" --header "apns-topic: com.testcompany.sampletest" --header "apns-push-type: alert" --header "apns-priority: 10" --header "apns-expiration: 0" --data '{"aps":{"alert":{"title":"Test Notification Title","subtitle":"Test Notification Sub Title","body":"Test Notification Body"}}}' --http2 https://api.push.apple.com:443/3/device/*devicetoken* Response: { "code": 400, "message": "bad-request", "reason": "The device token is inactive for the specified topic. There is no need to send further pushes to the same device token, unless your application retrieves the same device token.", "requestUuid": "c4ae39b4-87e1-4269-a1e9-163f60ec0385" } Scenario 2 : However, if we send the request with apns-push-type set to background, the request is processed successfully by APNs, but no notification is received on the device. Request : curl -v --header "authorization: bearer ${AUTHENTICATION_TOKEN}" --header "apns-topic: com.testcompany.sampletest" --header "apns-push-type: background" --header "apns-priority: 10" --header "apns-expiration: 0" --data '{"aps":{"alert":{"title":"Test Notification Title","subtitle":"Test Notification Sub Title","body":"Test Notification Body"}}}' --http2 https://api.push.apple.com:443/3/device/*devicetoken* Response: Getting a message that The notification sent successfully but no notification is received on the device. In both cases (with alert and background push types), the push notification does not reach the device. Additionally, when we validated the device token using the APNs Device Token Validator, it appears to be valid and returns the following message. "Device Token is valid for sending Alert & Background push-type notifications in the Production environment" Affected Device: macOS version : MacOS 15.3.1 Processor : Apple M1 Could you please assist me in resolving this issue? Thanks
2
1
111
2w
Delay timing to evaluate Menu content until it actually opens (macOS)
SwiftUI’s Menu is used also to display view controls like pop-up buttons. However, in such cases, its content is evaluated at the moment the button itself appears, although it’s not required until the menu is actually opened. Additionally, since the menu content isn’t re-evaluated when opened, if the content is dynamically generated, there could be a discrepancy between the actual state and the displayed state depending on the timing. Considering these points, I’d like to delay generating the menu content until the moment it’s actually opened. Is there a way to delay the evaluation and generation of the Menu’s content until the moment its contents are displayed? Note: I'd like to know about using it within a macOS app.
Topic: UI Frameworks SubTopic: SwiftUI Tags:
0
0
98
2w
What is the unit used for the availableKilobytes property of the target object?
In the online documentation for InstallerJS, it is stated that the unit for the availableKilobytes property of the target field is kilobytes. Isn't it actually bytes because of a bug in the very first release of macOS that supported InstallerJS? [Q] Has there been a fix in the recent years regarding this property that would explain why the documentation says it's kilobytes? Even though at the time of this writing, the unit is still bytes when you call my.target.availableKilobytes I'm using this call to dump the value of this property in install.log: system.log(my.target.availableKilobytes + ''); Ref. https://developer.apple.com/documentation/installer_js/target/1811975-availablekilobytes (FB20448952)
0
0
43
2w
What is the difference between applying "hardened runtime" to an executable and adding the `-o library` flag to codesign?
Hey, Just recently I realized something I have been overlooking in my build pipelines. I thought that by adding the the "hardened runtime", I disable 3rd-party library injection (I do not have the disable-library-validation entitlement added). However, I was using some checks on my code and I noticed that the "library validation" code signature check fails on my applications (e.g. adding the .libraryValidation requirement via the LightweightCodeRequirements framework) - with codesign -dvvvv /path/to/app I can check it doesn't have the CS_REQUIRE_LV flag: [...] CodeDirectory v=20500 size=937 flags=0x10000(runtime) hashes=18+7 location=embedded [...] then I used in Xcode the "Other Code Signing Flags" setting and added the -o library option, which added the flag: [...] CodeDirectory v=20500 size=937 flags=0x12000(library-validation,runtime) hashes=18+7 location=embedded [...] Is this flag something I should be explicitly setting? Because I was under the impression enabling hardened runtime would be enough. Popular Developer ID distributed applications (e.g. Google Chrome, Parallels Desktop, Slack) all have this flag set.
1
1
151
2w
TestFlight unable to install own application
Hi, I am facing a very weird issue where I am unable to download our own application from TestFlight for testing. This issue only happens for one of our applications; we are able to download our other applications without any issues. Furthermore, this only happens on one of our MacBooks; the game downloads fine on our other MacBook (macOS 15) and can run our application. When running the console, I noticed this error being thrown when the TestFlight fails the download: I have tried reinstalling TestFlight, clearing all instances of our application as what Finder can find, restarting the MacBook but nothing worked. Is there anyone that faced this similar issue, or any Apple staff that could help with this? OS version: macOS Tahoe (26 Beta) latest TestFlight was able to download on this version previously, until one day it couldn't (and not sure why), tried downloading latest version but did not solve the issue. Note: We noticed that we are unable to install our own application from the Appstore as well, on this MacBook that has the TestFlight issue.
16
6
841
2w
Will Apple Reject Apps That Read MacBook Lid-Angle Sensor via Private APIs?
Hey I’m working on a macOS app that wants to detect the MacBook lid / hinge angle (i.e. how far the screen is open) by directly reading the internal sensor via HID / IOKit (a private / undocumented API). I came across this project: LidAngleSensor — GitHub: https://github.com/samhenrigold/LidAngleSensor?tab=readme-ov-file Before investing too much effort, I’d like to ask the community: Has anyone succeeded in getting such an app accepted on the Mac App Store when it includes sensor-level, private API access like this? What were the reviewer feedback or rejection reasons (if any)? Are there documented cases (positive or negative) where Apple approved or rejected apps for accessing non-public hardware sensors? What’s the risk of getting banned or permanently rejected for integrating this kind of functionality? If you have direct experience (whether it passed or failed), I’d love to hear your stories, strategies, or pointers. Thanks in advance!
1
0
63
2w
NVMe External Disk working in MacOS Sequoia But not in Tahoe
Hi, I have been using external NVMe disk since March 2025 with my Mac M1 1TB until recently couple of days agao I updated Mac OS to Tahoe from Sequpoia 15.6. Now Mac OS Tahoe is disconnecting my NVMe automatically saying please eject the disc before disconnecting and suddenly after an hour it reconnects. Right now I have reinstall Mac OS Sequoia and My external NVMe disk is working again. This post is for Mac OS developers to check for APFS drivers on Mac Tahoe as they are messing up with external NVMe SSD. I dont know about others brand of NVMe I am using Transcend inclosure with transcend NVMe 2TB SSD hard disk. Kindly please check as its not NVMe issue its and OS issue. If it was NVMe issue my SSD should also not work with Sequoia but as it is working with Sequoia so it has to be something with Tahoe OS. Kindly review your code about APFS drivers or thunderbold USB C drivers or may be something else linked to APFS file system. I hope this post reaches you and you guys can consider it as help ful. Kind regards
1
0
171
2w
How To Position Controls With SwiftUI
I am coming from C#, where Forms and Controls are placed similar to Swift Storyboards. I have been trying to learn Storyboards, but keep running across tutorials regarding SwiftUI, and Storyboard examples are few. So the question becomes, "how do I position controls on a Form using SwiftUI?" See the example below. I have run across many videos that use either horizontal or vertical positioning of controls, but these examples are usually very simple, with items occupying only the center portion of the screen. I get stuck on examples that are more complicated. The example below only shows the controls for the upper part of a Form, with some type of textbox (Viewform) below making up the rest of the Form. How does one make more complicated placement of controls with SwiftUI?
10
0
346
2w
MenuBarExtra with .window style: .onHover modifier doesn't work on macOS 26 Tahoe
List { Text("ITEM 1") .onHover(perform: { hovering in debugPrint("hovering: ", hovering) }) .help("ITEM 1") Text("ITEM 2") .onHover(perform: { hovering in debugPrint("hovering: ", hovering) }) .help("ITEM 2") Text("ITEM 3") .onHover(perform: { hovering in debugPrint("hovering: ", hovering) }) .help("ITEM 3") } .fixedSize(horizontal: false, vertical: true) .frame(maxHeight: 200) } Hello everyone!!! Considering the snippet above, seems like the onHover action, including help modifiers, doesn't work for the elements of a List, on macOS Tahoe. The situation changes using a ScrollView embedding a LazyVStack, or disabling Liquid Glass from the info plist, so my guess is that the new Liquid Glass style has something to do with this issue though I didn't find any clue about it. Does anyone have any idea? Maybe there's a layer above that doesn't allow to trigger the onHover modifier? Thanks in advance for your help!
0
0
116
2w
ENABLE_ENHANCED_SECURITY module file not found
When I tried turning on ENABLE_ENHANCED_SECURITY = YES in an Xcode 26.1 beta project, I got a bunch of "module file not found" errors like this: While building module 'CoreServices': In file included from <module-includes>:1: /Applications/Xcode26.1-beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks/CoreServices.framework/Headers/CoreServices.h:19:2: fatal error: module file '/Volumes/Work/Xcode-derived/PlainCalc3-gixjfymjqamwmufdwcseugzjehqa/Build/Intermediates.noindex/ExplicitPrecompiledModules/CoreFoundation-5POB3HW0BHFSPWLD7DOOKAULM.pcm' not found: module file not found 19 | #include <CoreFoundation/CoreFoundation.h> | ^ I tried deleting the project's derived data. Is this a known issue?
0
0
39
2w