macOS is the operating system for Mac.

Posts under macOS tag

200 Posts
Sort by:

Post

Replies

Boosts

Views

Activity

macOS Menu disappears when converting from NSApplicationActivationPolicyAccessory to NSApplicationActivationPolicyRegular if display disconnected and reconnected
I'm not quite sure where the problem is, but I will describe what I am doing to recreate the issue, and am happy to provide whatever information I can to be more useful. I am changing the ActivationPolicy for my app in order to make it unobtrusive when in the background (e.g. hiding it from the dock and using only a menu bar status item). When the user activates the app with a hotkey, it changes from NSApplicationActivationPolicyAccessory back to NSApplicationActivationPolicyRegular. This allows normal usage (dock icon, menu bar, etc.) This works fine, except in a rare situation which I finally just tracked down. If there is a window open in the app and I use the hotkey to convert back to an accessory, and then disconnect and reconnect the display on which the app was previously displayed, when I convert the app back to "regular mode", the menu bar has disappeared (and I am left with an empty space at the top of the screen). I can also trigger this bug by having the display in question briefly mirror the other display (effectively "orphaning" the hidden app), and then restoring the original side-by-side configuration before activating the app again. The app otherwise works, but the menu bar is missing. Switching back and forth with other apps does not fix the problem. Quitting and restarting the app resolves the issue. As does disabling the accessory only mode and forcing the app to always remain in "regular mode" with a dock icon (there is a preference for this in my app). Once fixed, I can then re-enable the "accessory mode" and all is well until the bug is triggered again. The bug would normally occur quite sporadically, presumably requiring a particular combination of changing Spaces or displays, or having the computer go to sleep while this app was in accessory mode. Thus far, the above is the only way I have found that can replicate this issue on demand. If I close all windows before hiding the app, then it works fine when I revert to "regular mode". It only happens if there is a window open at the time. Using applicationDidChangeScreenParameters: on my AppDelegate indicates that there is a change in screen, and logging window.screen.frame for each open window in [NSApp orderedWindows] shows that the size changes from e.g. 1920x1080 to 0x0 and back while the display is disconnected or mirrored. There is also an error in the console in Xcode when this happens -- invalid display identifier <some UUID>. I have tried various options for window collectionBehavior, as well as various settings for Spaces (which I normally use). None of these changes has fixed the behavior thus far. I use [NSApp hide:self]; from my AppDelegate to hide the app, and [[NSRunningApplication currentApplication] activateWithOptions:NSApplicationActivateAllWindows];[NSApp unhide:self]; to bring it back to the front. I welcome any ideas for things to chase down, or requests for more specific information that would be useful. Thank you! Fletcher
1
0
200
1w
Nullifying Sandbox Contraints for an .xcodeproj following Xcode's 'command-line' template?
Environment: Xcode v. 16.2; Swift version 6+ Scenario: I have an .xcodeproj within an .xcsworkingspace that must follow the 'command-line' paradigm outside the sandbox. My UnitTest (using the newer 'Swift Test' vs 'XCTest') is hitting runtime fatal errors due to sandbox violations. Here's a typical error line from the compiler: 1 duplicate report for Sandbox: chmod(41377) deny(1) file-read-data /Users/Ric/Library/.. I've set the .entitlement to ignore sandbox: &amp;lt;key&amp;gt;com.apple.security.app-sandbox&amp;lt;/key&amp;gt; &amp;lt;false/&amp;gt; I also created a shell script in the project build phase to access my TestData which was copied via a Build Phase: #!/bin/bash BUILD_DIR="${BUILT_PRODUCTS_DIR}" TEST_DATA="${SRCROOT}/SwiftModelTest/TestData" mkdir -p "${BUILD_DIR}/TestData" cp -R "${TEST_DATA}/" "${BUILD_DIR}/TestData/" What do I need to allow real-time Testing of my code without worrying about the Sandbox?
1
0
213
2w
rebot when i close the lid@mac air 2024#M2 chipset#Version 15.2 Beta (24C5073e)
I have been experiencing an issue with my MacBook Air 2024 model that is equipped with the latest M3 chip. After upgrading to the beta version of the operating system, I've noticed that when I close the lid to put the laptop to sleep, and then open it to wake it up, the system unexpectedly restarts instead of resuming from where it left off. This behavior is not only inconvenient but also raises concerns about potential data loss or corruption during the unexpected restarts. I understand that beta versions can have bugs, but I was hoping to receive some guidance on whether this is a known issue or if there are any steps I can take to troubleshoot and resolve this problem. Any assistance or insights into this matter would be greatly appreciated.
2
0
192
2w
Problem with deleting the MinimaList app
A question from an ordinary user for developers: The essence of the problem: I installed the To Do List by MinimaList app on both my MacBook and iPhone. After installing it, I decided not to use it and deleted the application. https://apps.apple.com/us/app/minimalist-to-do-list-widget/id993066159 However, it turned out that not everything was removed. Specifically: • In the “Allow Others to Find Me” section on both my MacBook and iPhone, these apps still appear. No matter what I do—whether I delete or clear them—they continue to be displayed there. • This app continues to appear in the section located at: Settings → Apple ID → iCloud → Stored in iCloud → See All → Allow Finding Me – To Do List and one more item. • It cannot be deleted. • It won’t delete on my MacBook, and it won’t delete on my iPhone. • It also appeared in iCloud itself under the Email Search section. P.S. The official Apple support (without violating any internal regulations) advised me to post on the forum to get in touch with Apple developers. In hope, I am posting this question here.
0
0
144
2w
Widgets not showing up in MacOS widget gallery
I have a multiplatform app that I've been working on that targets iphones, ipad, and macos. I also have a widgetextension that targets all three devices. On iphones and ipads, the widgets show up in the widget gallery with no problems. But on the mac, the widget center does show my app, but its widgets are "from iPhone" meaning that if my app was not install on an iphone, they just won't show up on the mac at all. I have not idea of what I'm doing wrong or how to fix it. Do I need to create a widget extension for the mac seperately?
2
0
203
5d
Xcode 16 having issue on macOS 14 arm-64 and 15 arm-64 images
Issue description: Using Xcodebuild command to build a project using Xcode 16.1 and 16.2, getting multiple device simulator warnings with same os and same model. Please see issue: https://github.com/actions/runner-images/issues/11036 Repro steps: create a Xcode project, build it using below command with Xcode 16 version. run: | echo "Building project manually..." xcodebuild -workspace MyApp.xcworkspace -scheme MyApp -destination 'platform=iOS Simulator,name=iPhone 16 Pro,OS=18.2' build | xcbeautify --renderer github-actions
1
0
214
5d
Custom app icon on macOS
I would like to provide a way to choose an app icon as a reward for using the referral feature of the app. I found that setting the image via NSApp.applicationIconImage works, but only when the app is running, and the app icon is reset on the next launch. I also found NSDockTile plugin APIs, and that seems to be the way, but it won't be allowed on the Mac App Store. Is there really no way to do it legit way and pass the Mac App Store review? Seems to be another really strange limitation imposed.
1
0
177
3w
SwiftUI TabVIew Faulting while switching between Tabs
I'm working on a SwiftUI based application for MacOS. I have a TabView component with two child Tab components. These Tab components display a List, each derived from an array of elements. While the application is running, clicking on the tabs in the TabView should switch between the views of different Lists. What I'm experiencing is that switching between the tabs causes a FAULT. With errors: Row index 1 out of row range (numberOfRows: 1) for <SwiftUI.SwiftUIOutlineListView: 0x1299d2000> Followed by: ( 0 CoreFoundation 0x000000019e096e80 __exceptionPreprocess + 176 1 libobjc.A.dylib 0x000000019db7ecd8 objc_exception_throw + 88 2 AppKit 0x00000001a1c744e8 -[NSTableRowData _availableRowViewWhileUpdatingAtRow:] + 0 3 SwiftUI 0x00000001cd8953f4 $s7SwiftUI0A17UIOutlineListViewC11removeItems2at8inParent13withAnimationy10Foundation8IndexSetV_ypSgSo07NSTableeL7OptionsVtF + 1232 ... ... ) And finally: FAULT: NSTableViewException: Row index 1 out of row range (numberOfRows: 1) for <SwiftUI.SwiftUIOutlineListView: 0x1299d2000>; (user info absent) This error happens when switching between the two tabs, defined thusly: @main struct MyApp: App { @State var rootDirectory: URL @State var selectedItem: URL @State var projectNavItems: [NavigationItem] = [] @State var jotNavItems: [NavigationItem] = [] @State var importerIsPresented: Bool = false let fileManager = FileManager.default init() { rootDirectory = URL(string: FileManager.default.currentDirectoryPath)! selectedItem = URL(string: FileManager.default.currentDirectoryPath)!.appendingPathComponent("README.md") } var body: some Scene { WindowGroup { NavigationSplitView { TabView { Tab("Projects", systemImage: "tray.and.arrow.down.fill") { List(projectNavItems, selection: $selectedItem) { // Changing this NavigationLink line to Text($0.title) makes no difference NavigationLink($0.title, value: $0.id) } } Tab("Jots", systemImage: "tray.and.arrow.up.fill") { List(jotNavItems, selection: $selectedJot) { // Can be written as Text($0.title) with no change in behavior NavigationLink($0.title, value: $0.id) } } } } detail: { Editor(for: selectedItem) } .fileImporter( isPresented: $importerIsPresented, allowedContentTypes: [UTType.folder], allowsMultipleSelection: false ) { result in // Code that gets a security scoped resource and populates the // projectNavItems: [NavItem] and jotNavItems: [NavItem] // arrays } } .commands(content: { CommandGroup (before: .newItem) { Button("Open Journal...") { importerIsPresented.toggle() } } }) } } The error only happens when both Tab views are populated by a List. If the Tab view have different child components, say a List, and a ForEach of Text components, switching between the tabs doesn't produce this error. List views with Text child components also produce this error. Here are screenshots of the running application Once the user selects a directory, we see the first Tab > List component populated by contents from the projectNavItems array: Clicking on the 'Jots' tab switches to the appropriate tab and correctly lists the items in the jotNavItems array, except there are additional lines, seemingly showing that there's an issue. Clicking back on the 'Projects' tab switches back, but now the List shows only one of the items from the projectNavItems array. Finally, clicking on 'Jots' again causes the errors to print in the console and interactivity with the tab components ceases. Last screenshot is representative of this state as the application FAULTS. This seems like a bug in SwifUI, wondering what workarounds I might be able to implement. I can provide the full backtrace, I cropped it for content length.
2
0
210
3w
"Baking together" two audio tracks into one for drag-and-drop
Hi all, with my app ScreenFloat, you can record your screen, along with system- and microphone audio. Those two audio feeds are recorded into separate audio tracks in order to individually remove or edit them later on. Now, these recordings you create with ScreenFloat can be drag-and-dropped to other apps instantly. So far, so good, but some apps, like Slack, or VLC, or even websites like YouTube, do not play back multiple audio tracks, just one. So what I'm trying to do is, on dragging the video recording file out of ScreenFloat, instantly baking together the two individual audio tracks into one, and offering that new file as the drag and drop file, so that all audio is played in the target app. But it's slow. I mean, it's actually quite fast, but for drag and drop, it's slow. My approach is this: "Bake together" the two audio tracks into a one-track m4a audio file using AVMutableAudioMix and AVAssetExportSession Take the video track, add the new audio file as an audio track to it, and render that out using AVAssetExportSession For a quick benchmark, a 3'40'' movie, step 1 takes ~1.7 seconds, and step two adds another ~1.5 seconds, so we're at ~3.2 seconds. That's an eternity for a drag and drop, where the user might cancel if there's no immediate feedback. I could also do it in one step, but then I couldn't use the AV*Passthrough preset, and that makes it take around 32 seconds then, because I assume it touches the video data (which is unnecessary in this case, so I think the two-step approach here is the fastest). So, my question is, is there a faster way? The best idea I can come up with right now is, when initially recording the screen with system- and microphone audio as separate tracks, to also record both of them into a third, muted, "hidden" track I could use later on, basically eliminating the need for step one and just ripping the two single audio tracks out of the movie and only have the video and the "hidden" track (then unmuted), but I'd still have a ~1.5 second delay there. Also, there's the processing and data overhead (basically doubling the movie's audio data). All this would be great for an export operation (where one expects it to take a little time), but for a drag-and-drop operation, it's not ideal. I've discarded the idea of doing a promise file drag, because many apps do not accept those, and I want to keep wide compatibility with all sorts of apps. I'd appreciate any ideas or pointers. Thank you kindly, Matthias
1
0
386
4d
Unified Logging System in Go
Hi, I'm developing a multi-platform project in Windows, Mac and Linux. I am trying to create a wrapper class in Go that will query system information and history. I see that the Unified Logging System is a sophisticated way to get all sorts of kernel information (and even a long history including rotated logs). However, I am struggling to see how I can use the APIs in other languages aside from Swift itself (or C). I do not want to use the log or last commands to query information in separate child processes in my project. I would like to simply query the database itself, similar to using OSLog in Swift. If this is something that is entirely proprietary or not possible, let me know :)
4
0
285
3w
What is the alternative to Environment and Library Constraints before macOS 14.0?
In the macOS 14.0 SDK, environment and library constraints were introduced, which made defense against common attack vectors relatively simple (especially with the LightWeightCodeRequirements framework added in 14.4). Now, the application I'm working on must support macOS 13.0 too, so I was looking into alternatives that do work for those operating systems as well. What I found myself is that the SecCode/SecStaticCode APIs in the Security Framework do offer very similar fashion checks as the LightWeightCodeRequirements framework does: SecCodeCopySigningInformation can return values like signing identifier, team identifier, code requirement string and so on. SecStaticCodeCreateWithPath can return a SecStaticCode object to an executable/app bundle on the file system. Let's say, I would want to protect myself against launchd executable swap. From macOS 14.0 onward, I would use a Spawn Constraint for this, directly in the launchd.plist file. Before macOS 14.0, I would create a SecStaticCode object for the executable path found in the launchd.plist, and then examine its SecCodeCopySigningInformation dictionary. If the expectations are met, only then would I execute the launchd.plist-defined executable or connect to it via XPC. Are these two equivalent? If not, what are the differences?
3
0
432
3w
WidgetKit Simulator with Intent Configurations
Xcode 16.2 are unavailable to develop widget with dynamic options, no matter SiriIntent or AppIntent that I try to use. I have try to start a complete new project, then add widget with app intent checkbox check, with zero code changed then i press command run and WidgetKit Simulator present CHSErrorDomain error 1103 always, if i try to add widget directly from desktop, dynamic options are available to select but widgets doesn't seem like load successfully, it is stuck same in the WidgetKit Simulator. I also try to start a new project in my other MacBook but no luck, this error are presenting all the time, I'm totally stuck here, does anybody having this issue?
2
0
330
3w
Chrome replaced by Safari after in-app upgrade
Hello I want to report an issue on macOS, I also reported this issue on feedbackassistant, but I didn't get a response from the feedbackassistant. I am sorry it might not be appropriate to post it here, if so, you can move or delete this post or ask me to to so. Thanks. In short words, Chrome/Edge/Firefox users who manually set the browser as default browser in the macOS System setttings, will lose their default browser setting after browser a upgrade. What steps will reproduce the problem? (1) Install Chrome Canary, in my case I was using 134.0.6961.0. After installation, open it from launchpad, but don't set it as the default browser in the browser (2) Go to macOS's system settings, search Deafult Web Browser, set the new installed Chrome Canary as default browser (3) Go to Chrome Canary's Settings->About Chrome (4) Wait for Chrome update information to be updated (it will auto update to the latest version) (5) Check result of system default browser. Click a link from Notes, it will navigate to Safari. What is the expected result? System default browser should not change What happens instead? The System default browser changed to the topmost browser of the brower list in system settings. Click a link from Notes, it will be opened in Safari. Notes This bug also happens on Firefox and Edge, it should be a macOS bug. This bug is similar to https://issues.chromium.org/issues/346505950 Looks like after installation, macOS recognize the newly installed version of browser as a new browser, even though the signature of the application remained the same. In Local Network of macOS settings, some Edge users see multiple entries with the same name.
1
0
292
Jan ’25
Identifying SwiftUI list cells in XCUITest
In my macOS app I have a SwiftUI list that starts like this: List(selection: $selection) { HStack { Label("Staging", systemImage: "arrow.up.square") Spacer() WorkspaceStatusBadge(unstagedCount: model.statusCounts.unstaged, stagedCount: model.statusCounts.staged) } (where WorkspaceStatusBadge is a custom view that just contains a Text) I'm trying to set the accessibility ID of that first cell so I can find it in XCUITest. If I apply the accessibilityIdentifier() modifier to the HStack, it instead sets the ID of the two static text elements inside it, and the cell still has no ID. I could find the cell based on the ID of the child staticText, but I have some other cases where this doesn't work as well. If I use .accessibilityElement() on the HStack, then XCUI sees a cell containing a Group element with the ID. This might be workable, but it's certainly not ideal. So how do I set the ID of the cell itself?
3
0
235
Jan ’25
iPadOS 18 App (on Apple Silicon) - Duplicate Tab Bar Appearing in Toolbar
With iPadOS 18, the UITabBar now defaults to the floating style. I successfully reverted the tab bar to its traditional style by overriding the UITabBarController's horizontalSizeClass property: self.tabBarController?.traitOverrides.horizontalSizeClass = .unspecified When I launch the app on my Mac using Apple Silicon, TWO tab bars appear: One appears at the bottom of the screen, like a traditional tab bar. The second tab bar is still embedded in the app toolbar in its floating style. Is this a bug? How do you ensure that overriding the horizontalSizeClass will remove/hide the floating tab bar when running an app on Apple Silicon? TIA! (Demonstrated on a test project)
0
0
207
Jan ’25
How to run application as root permission?
Hi, I’m able to view the activity log using the macOS application integrated with Endpoint Security Entitlement in Xcode by setting Debug Process As: root. However, after archiving the application into a .app using a Developer ID Application certificate and sending it to my friend, they encountered the error ES_NEW_CLIENT_RESULT_ERR_NOT_PRIVILEGED during client initialization when running the application. Could you please guide me on how to resolve this issue? Specifically, what is the correct technical approach to make the application run as root? Thanks
3
0
268
Jan ’25