macOS is the operating system for Mac.

Posts under macOS tag

200 Posts
Sort by:

Post

Replies

Boosts

Views

Activity

Inconsistency in Location Services in macOS Apps
I am encountering some issues with location services in macOS apps. Despite including the necessary keys in the app’s info.plist, I am unable to request user location permission. Here are the details: Cannot request location permission using requestWhenInUseAuthorization(), ie., no location permission grant permissions popup is appearing. The app contains NSLocationUsageDescription in the info.plist. I have also tested by adding NSLocationAlwaysAndWhenInUseUsageDescription, NSLocationWhenInUseUsageDescription, and NSLocationAlwaysUsageDescription, but it didn't work. So to show the location request popup, I was directly(irrespective of the authorizationStatus) requesting location using requestLocation(), which showed the location permission grant permissions popup. But then I encountered another issue. If the popup is left as it is, every time requestLocation() is called a new location request popup appears (which comes after allowing/denying the popup). Also observed that didChangeAuthorization is only called on allowing/denying the last location request pop up. Initial calls to CLLocationManager().authorizationStatus return Not Determined. When I checked the location permission state of my app on launch, I used to get not Determined for some time, even if the permission was granted. Code snippet: private var locationManager: CLLocationManager { let lm = CLLocationManager() lm.delegate = self lm.desiredAccuracy = kCLLocationAccuracyBest return lm } private var currentAuthorizationStatus: CLAuthorizationStatus { if #available(macOS 11.0, *) { return CLLocationManager().authorizationStatus } else { return CLLocationManager.authorizationStatus() } } switch currentAuthorizationStatus { case .notDetermined: print("requesting permission") locationManager.requestWhenInUseAuthorization() case .restricted, .denied: print("location permission is restricted") case .authorizedAlways, .authorizedWhenInUse, .authorized: print("requesting location") locationManager.requestLocation() @unknown default: print("Unknown error occurred") } I would appreciate any guidance or suggestions on how to resolve these issues. Thank you!
0
0
37
4h
I tried to add a overlay window onto app in full screen mode but failed
As the topic mentioned, I want to add a overlay window onto Apps that are in full screen mode, trying to create some blur effect on the screen. But Apple seems to treat full screen mode Apps differently as a "space." So currently I can only apply the blur effect like this. (This is my Desktop page) But When it doesn't affect the full screen mode Apps. (For example: My Xcode) And I know some of the App down this kind of stuff. Like this This is my current code. Hope someone can tell me how to solve it.
1
0
75
1d
SwiftUI List OutlineGroup
Hello, I'm having some difficulties trying to customise a SwiftUI list-detail splitview using List and OutlineGroup: The model used is provided in Apple documentation OutlineGroup. The contentView is struct ContentView: View { @State var itemString = String() var body: some View { HSplitView { MyOutLine(title: "MyOutLine", itemString: $itemString) .frame(width: 200, height: 300 , alignment: Alignment(horizontal: .leading, vertical: .top)) .padding() MyView(itemString: itemString) } } } The left view is struct MyOutLine: View { let title:String @Binding var itemString:String @State private var selection: FileItem? var body: some View { List(selection: $selection) { OutlineGroup(data, children: \.children) { item in Text ("\(item.description)") .onTapGesture { selection = item itemString = item.description } .listRowBackground( selection == item ? Color.gray :nil ) } } .listStyle(.sidebar) .onAppear { itemString = "No selection"} } } The right view is: struct MyView: View { let itemString:String var body: some View { VStack{ Spacer() HStack { Spacer() Text(itemString) Spacer() } Spacer() } } } The result works but I have 2 problems: The selection works but the detail view is updated only when I click the text but not when I click the rest of the row. This results in the detail view not being sync with the list selection. I would like to customise the colour of the selected row but listRowBackground does not seem to work. Is there a way to fix this Thank you in advance Jean Marie
2
0
69
2h
What is the reason for NSURLSession Trust evaluation fail
Hi All: Our use NSURLSession dataTaskWithRequest to connect our https server, However, in one macOS, sometimes, we encounter these error when TLS handshake. default 2024-06-24 17:52:03.054447 +0900 test-app boringssl_context_info_handler(2069) [C1209.1.1:2][0x7f9067117b10] Client handshake state: TLS client read_server_certificate info 2024-06-24 17:52:03.054462 +0900 test-app boringssl_session_handshake_incomplete(97) [C1209.1.1:2][0x7f9067117b10] Handshake incomplete: waiting for data to read [2] info 2024-06-24 17:52:03.054552 +0900 test-app boringssl_session_handshake_incomplete(97) [C1209.1.1:2][0x7f9067117b10] Handshake incomplete: waiting for data to read [2] info 2024-06-24 17:52:03.054557 +0900 test-app boringssl_session_handshake_incomplete(97) [C1209.1.1:2][0x7f9067117b10] Handshake incomplete: waiting for data to read [2] info 2024-06-24 17:52:03.054590 +0900 test-app boringssl_session_handshake_incomplete(97) [C1209.1.1:2][0x7f9067117b10] Handshake incomplete: waiting for data to read [2] default 2024-06-24 17:52:03.054769 +0900 test-app boringssl_context_info_handler(2069) [C1209.1.1:2][0x7f9067117b10] Client handshake state: TLS client read_certificate_status default 2024-06-24 17:52:03.054773 +0900 test-app boringssl_context_info_handler(2069) [C1209.1.1:2][0x7f9067117b10] Client handshake state: TLS client verify_server_certificate default 2024-06-24 17:52:03.055123 +0900 test-app boringssl_context_evaluate_trust_async(1635) [C1209.1.1:2][0x7f9067117b10] Performing external trust evaluation default 2024-06-24 17:52:03.055308 +0900 test-app boringssl_context_evaluate_trust_async_external(1620) [C1209.1.1:2][0x7f9067117b10] Asyncing for external verify block info 2024-06-24 17:52:03.055316 +0900 test-app boringssl_session_handshake_incomplete(97) [C1209.1.1:2][0x7f9067117b10] Handshake incomplete: certificate evaluation result pending [16] default 2024-06-24 17:52:03.055466 +0900 test-app Connection 1209: asked to evaluate TLS Trust default 2024-06-24 17:52:03.056082 +0900 test-app Task <407E11A6-12E8-4818-82B4-BC5B4909130F>.<1405> auth completion disp=1 cred=0x0 default 2024-06-24 17:52:03.064388 +0900 test-app Trust evaluate failure: [leaf SSLHostname TemporalValidity] default 2024-06-24 17:52:03.064390 +0900 test-app System Trust Evaluation yielded status(-9802) error 2024-06-24 17:52:03.064392 +0900 test-app ATS failed system trust error 2024-06-24 17:52:03.064393 +0900 test-app Connection 1209: system TLS Trust evaluation failed(-9802) default 2024-06-24 17:52:03.064393 +0900 test-app Connection 1209: TLS Trust result -9802 error 2024-06-24 17:52:03.064395 +0900 test-app Connection 1209: TLS Trust encountered error 3:-9802 error 2024-06-24 17:52:03.064397 +0900 test-app Connection 1209: encountered error(3:-9802) default 2024-06-24 17:52:03.064400 +0900 test-app Connection 1209: cleaning up default 2024-06-24 17:52:03.064404 +0900 test-app Connection 1209: summary for unused connection {protocol="(null)", domain_lookup_duration_ms=0, connect_duration_ms=0, secure_connection_duration_ms=0, private_relay=false, idle_duration_ms=0} default 2024-06-24 17:52:03.064438 +0900 test-app [C1209 63DEF1F8-AC5F-4285-B32B-D3AE707C513A Hostname#229f20b3:443 tcp, url hash: 693c58e9, tls, definite, attribution: developer] cancel I found TLS Trust evaluation failed(-9802) this error. I checked server's certificate, it is ok. On this macOS, this issue happens sometimes, not always. Thanks for your feedback.
0
0
57
1d
Problem with event tap permission in Sequoia
I have a Mac app with a background-only helper app that needs to have Accessibility permission in order to use an event tap that can modify events. This has worked OK through Sonoma, but in the Sequoia beta it is failing to create the tap. C code to test the ability to create the event tap: static CGEventRef _Nullable DummyTap(CGEventTapProxy proxy, CGEventType type, CGEventRef event, void *userInfo) { return NULL; } static bool CanFilterEvents( void ) { CFMachPortRef thePort = CGEventTapCreate( kCGSessionEventTap, kCGTailAppendEventTap, kCGEventTapOptionDefault, // active filter, not passive listener CGEventMaskBit(kCGEventKeyDown), DummyTap, NULL ); bool madeTap = (thePort != NULL); if (madeTap) { CFMachPortInvalidate( thePort ); CFRelease( thePort ); } return madeTap; } So, on Sequoia, CanFilterEvents returns false in spite of Accessibility permission being granted in System Settings. CGPreflightPostEventAccess also returns false, but AXIsProcessTrusted returns true. I tried making a non-background-only test app, and when that has Accessibility permission, CanFilterEvents, CGPreflightPostEventAccess, and AXIsProcessTrusted all return true. Suggestions on what to try next?
0
0
45
1d
Display interactable UI on macOS login screen
We are developing a lightweight VPN client inside a daemon process that will run even when no user session is active on machine. The lightweight VPN runs in machine context and does not require user session. We would like to display some basic diagnosis information about our lightweight client on macOS login window before user is logged into their machine (in case users need that). So, is it possible to display a UI window on login screen with some basic info that user can interact with. If yes, where can I get started? Please note, this is not an authorization plugin. We are just wanting to display info about our process that runs a lightweight VPN client on macOS login screen.
0
0
50
2d
[macOS]: DNSServiceQueryRecord is not working as per document
Hi Team, We are using the transparent app proxy in macOS and resolving DNS queries using DNSServiceQueryRecord in the TAP process. According to the documentation, when passing the interfaceIndex as 0, it should be queried on all interfaces, and based on IP rules, it assigns the query to that particular interface. However, when we pass 0, it does not query any of the interfaces. We need to provide the specific interface index.
1
0
63
2s
macOS Widgets won't launch with app group set
i'm working on an app which shares a swiftdata database between the main app and its widgets. prior to the sequoia/xcode 16 betas this was working fine with setting the same app group for app & widget targets. however, now whenever i try to run my main app from Xcode i get a user permission requestor saying " would like to access data from other apps.". this happens every time i run it. whenever the widget is started (via trying to place it on the desktop, or the widgetkit simulator etc) it exits immediately (i assume because it can't show the permission requestor?) if i disable the app group for the widget, it runs.. however, of course, i can't access the main app's database. i'm on sequoia beta 2 (24A5279h) and Xcode 16 beta 2 (16A5171r) note: while the widgetkit simulator is now present in sequoia beta 2, i haven't actually been able to successfully use it
2
1
61
1d
How to animate NavigationSplitView's detailView column.
Having a traditional 'NavigationSplitView' setup, I am looking for a way to animate it the same as the sidebarView, where there is a button to toggle and it animates by sliding out from the right side of the view, however the closest I have gotten was manipulating the 'navigationSplitViewColumnWidth' but that always results in the view instantly appearing / disappearing. I am using SwiftUI for a MacOS specific app. Here is just a general idea of what I am currently doing, it is by no means a reflection of my real code but serves the purpose of this example. struct ContentView: View { @State private var columnWidth: CGFloat = 300 var body: some View { NavigationSplitView { List { NavigationLink(destination: DetailView(item: "Item 1")) { Text("Item 1") } NavigationLink(destination: DetailView(item: "Item 2")) { Text("Item 2") } NavigationLink(destination: DetailView(item: "Item 3")) { Text("Item 3") } } .navigationTitle("Items") } detail: { VStack { DetailView(item: "Select an item") Button(action: toggleColumnWidth) { Text(columnWidth == 300 ? "Collapse" : "Expand") } .padding() } } .navigationSplitViewColumnWidth(columnWidth) } private func toggleColumnWidth() { withAnimation { columnWidth = columnWidth == 300 ? 0 : 300 } } } struct DetailView: View { var item: String var body: some View { Text("Detail view for \(item)") .navigationTitle(item) .padding() } } @main struct MyApp: App { var body: some Scene { WindowGroup { ContentView() } } }
1
0
134
1d
TabSection always show sections actions.
I'm giving a go to the new TabSection with iOS 18 but I'm facing an issue with sections actions. I have the following section inside a TabView: TabSection { ForEach(accounts) { account in Tab(account.name , systemImage: account.icon, value: SelectedTab.accounts(account: account)) { Text(account.name) } } } header: { Text("Accounts") } .sectionActions { AccountsTabSectionAddAccount() } I'm showing a Tab for each account and an action to create new accounts. The issue I'm facing is that when there are no accounts the entire section doesn't appear in the side bar including the action to create new accounts. To make matters worse the action doesn't show at all in macOS even when there are already accounts and the section is present in side bar. Is there some way to make the section actions always visible?
0
0
114
4d
Memory leak in ARC conversion, KVO involved
I'm trying to do a piecemeal conversion of a big macOS Objective-C++ code base to use Automatic Reference Counting (ARC), and started with a fairly complex modal dialog. I converted all the classes involved to use ARC. When the dialog closes, the window itself, and some of the controller objects, get deallocated as they should, but some do not. When I look at the memory debugging graph in Xcode, I see a bunch of things of the form NSKVONotifying_MyClassName. Here's an example: It does not look as though any of my objects have strong references to GRMorphController, so what am I to make of this?
2
0
106
3d
iMac stuck on checking null
On any update, regardless if it’s Mojave or high sierra or catalina many Apple iMac owners were having issues with this- “iMac is stuck on Checking null, it won’t go any further. How do I fix this?”. I spoke to 4 representatives and no Apple representative could help with my issue. So here is a 100% solution. back up your iMac if you don’t want to lose anything. hold the power button until your iMac turns off ouch the power button and let go immediately and push and hold “COMMAND” and “R” until your utilities pop up. Erase and reinstall a new versio of your current macOS update. Let this finish and DO NOT sign into your Apple ID now. Accept the terms and cond and follow all the steps. Once you are in the computer you can sign in. now you may update your iMac to whichever update.
1
0
75
4d
macOS sequoia 15 beta 2在点击更新后进入更新了一下进去后还是没变 进入设置-软件更新-立即重新启动 更新系统确实进入了更新界面,出现了Apple logo和进度条,但是等它更完进去后发现软件更新里还是原来显示的macOS sequoia 15 beta 2,没有变动,就像没有更新一样,还是在15.0,不是macOS sequoia 15 beta 2,我的电脑是Mac mini m2版本的(Mac14,3)
macOS sequoia 15 beta 2在点击更新后进入更新了一下进去后还是没变 进入设置-软件更新-立即重新启动 更新系统确实进入了更新界面,出现了Apple logo和进度条,但是等它更完进去后发现软件更新里还是原来显示的macOS sequoia 15 beta 2,没有变动,就像没有更新一样,还是在15.0,不是macOS sequoia 15 beta 2,我的电脑是Mac mini m2版本的(Mac14,3)
0
0
110
1w
Certificates, Identifiers & Profiles duplicatedcertificate
In my developper account, "Certificates, Identifiers & Profiles" show two "Developer ID Installer" certificates (Expiration Date 2027/05/13 and 2027/02/01) I did not found any way to delete, remove or revoke one. How can I fix it ? Xcode complaint "Command CodeSign failed with a nonzero exit code" Previouly I put right this error with the command: xattr -cr path_to_application but this no longer work.
1
0
153
1w
Access Bluetooth in system daemon - Unauthorized
Hello, as the title says, I am trying to access Bluetooth in a system daemon. I am running on MacOS Sonoma 14.5. When initializing Bluetooth, my daemon received Unauthorized state. I have tried to add my daemon in the system settings (System Preferences > Security & Privacy > Privacy > Bluetooth) "Allow applications to access Bluetooth" by adding the program executable path defined by the entry Program of my system daemon as suggested here: https://developer.apple.com/forums/thread/662459. But I am still having the issue. Writing a system daemon with Bluetooth is not my final goal. The bigger picture is the smartcard reader driver with Bluetooth access which as the same issue and the solution is probably related. I do not remember how but my smartcard reader driver use to work with Bluetooth but it does now with the same Unauthorized error. As far as I can see daemon and smartcard drivers does not have support for entitlement. Here are the logs for my sample system daemon: my_daemon [0x6000011b0000] activating connection: mach=true listener=false peer=false name=com.apple.server.bluetooth.le.att.xpc bluetoothd [0x7f804828e8a0] activating connection: mach=false listener=false peer=true name=com.apple.server.bluetooth.le.att.xpc.peer[76672].0x7f804828e8a0 bluetoothd Received XPC message "CBMsgIdCheckIn" from session "" bluetoothd Received XPC check-in from session "my_daemon-5555494498236e3b5e2e395b93c13af176769937-peripheral-76672-67" fAccessLevel 0 fProgrammaticPairing 0 fLimitedForMediaAccess 0 bluetoothd Access level is less than kXPCAccessLevelSystem for session "my_daemon-5555494498236e3b5e2e395b93c13af176769937-peripheral-76672-67". Restricted state operation not allowed bluetoothd Sending 'session attached' event for session "my_daemon-5555494498236e3b5e2e395b93c13af176769937-peripheral-76672-67" bluetoothd Attached session for "my_daemon-5555494498236e3b5e2e395b93c13af176769937-peripheral-76672-67" with session: 0x7f804802d1b0, session handle: 0xef8d0000 bluetoothd Registering peripheral session "my_daemon-5555494498236e3b5e2e395b93c13af176769937-peripheral-76672-67" with backgrounding: off, persistence: off (CBSR) restoreID: (null) bluetoothd Error getting Application State for <private>: <private>, 3 bluetoothd Error getting Application State for <private>: <private>, 3 bluetoothd Session "my_daemon-5555494498236e3b5e2e395b93c13af176769937-peripheral-76672-67" tccRequired : 1 bluetoothd ReadyForTCC. TCC required:1 fLimitedForMediaAccess:0 fDeviceAccessForMediaExtension:0 bluetoothd Session "my_daemon-5555494498236e3b5e2e395b93c13af176769937-peripheral-76672-67" : needsRestrictedStateOperation = 0, overrideRestrictedState = 0 , denylistMode = 0, receivesControllerBTClockEvents=0 my_daemon Received CBMsgIdReadyForTCC my_daemon Running performTccCheck CBManager tccAvail 1, tccRequired 1 my_daemon TCC required my_daemon [0x6000011b8000] activating connection: mach=true listener=false peer=false name=com.apple.tccd my_daemon [0x6000011b8000] failed to do a bootstrap look-up: xpc_error=[3: No such process] my_daemon [0x6000011b8000] invalidated after a failed init my_daemon send_message_with_reply(): user tccd unavailable, sending 0x600000ab4000 to system tccd my_daemon [0x6000011b4000] activating connection: mach=true listener=false peer=false name=com.apple.tccd.system tccd [0x7fd4d1f7ed80] activating connection: mach=false listener=false peer=true name=com.apple.tccd.system.peer[76672].0x7fd4d1f7ed80 tccd REQUEST: tccd_uid=0, sender_pid=76672, sender_uid=0, sender_auid=-1, function=TCCAccessRequest, msgID=76672.1 tccd AUTHREQ_CTX: msgID=76672.1, function=<private>, service=kTCCServiceBluetoothAlways, preflight=no, query=1, client_dict=(null), daemon_dict=<private> tccd AUTHREQ_ATTRIBUTION: msgID=76672.1, attribution={requesting={TCCDProcess: identifier=my_daemon-5555494498236e3b5e2e395b93c13af176769937, pid=76672, auid=0, euid=0, binary_path=/Users/olivier/daemon/my_daemon}, }, tccd AUTHREQ_SUBJECT: msgID=76672.1, subject=/Users/olivier/daemon/my_daemon, tccd Refusing TCCAccessRequest for service kTCCServiceBluetoothAlways from client Sub:{/Users/olivier/daemon/my_daemon}Resp:{TCCDProcess: identifier=my_daemon-5555494498236e3b5e2e395b93c13af176769937, pid=76672, auid=0, euid=0, binary_path=/Users/olivier/daemon/my_daemon} in background session tccd AUTHREQ_RESULT: msgID=76672.1, authValue=0, authReason=5, authVersion=1, error=(null), tccd REPLY: (0) function=TCCAccessRequest, msgID=76672.1 my_daemon [0x6000011b4000] invalidated after the last release of the connection object bluetoothd Received XPC message "CBMsgIdTCCDone" from session "my_daemon-5555494498236e3b5e2e395b93c13af176769937-peripheral-76672-67" tccd [0x7fd4d1f7ed80] invalidated after getting a no-senders notification - client is gone bluetoothd [0x7f80482820f0] activating connection: mach=true listener=false peer=false name=com.apple.tccd.system tccd [0x7fd4d32585f0] activating connection: mach=false listener=false peer=true name=com.apple.tccd.system.peer[169].0x7fd4d32585f0 tccd REQUEST: tccd_uid=0, sender_pid=169, sender_uid=0, sender_auid=-1, function=TCCAccessRequest, msgID=169.48 tccd [0x7fd4d313d880] activating connection: mach=true listener=false peer=false name=com.apple.tccd tccd [0x7fd4d313d880] failed to do a bootstrap look-up: xpc_error=[3: No such process] bluetoothd [0x7f80482820f0] invalidated after the last release of the connection object bluetoothd Bluetooth user permission alwaysAuth: denied tccd [0x7fd4d313d880] invalidated after a failed init tccd FORWARD: to=com.apple.tccd/0, request: { require_purpose=<xpc_null> service="kTCCServiceBluetoothAlways" function="TCCAccessRequest" preflight=true target_token={pid:76672, auid:-1, euid:0} TCCD_MSG_ID="169.48" background_session=false } tccd REPLY: from=com.apple.tccd, reply: { XPCErrorDescription="Connection invalid" } tccd forwardMessage error: Connection invalid. tccd [0x7fd4d3152bf0] activating connection: mach=false listener=false peer=true name=com.apple.tccd.system.peer[169].0x7fd4d3152bf0 bluetoothd [0x7f80482820f0] activating connection: mach=true listener=false peer=false name=com.apple.tccd.system tccd REQUEST: tccd_uid=0, sender_pid=169, sender_uid=0, sender_auid=-1, function=TCCAccessRequest, msgID=169.49 tccd [0x7fd4d32585f0] invalidated after getting a no-senders notification - client is gone tccd [0x7fd4d1f4c810] activating connection: mach=true listener=false peer=false name=com.apple.tccd tccd [0x7fd4d1f4c810] failed to do a bootstrap look-up: xpc_error=[3: No such process] tccd [0x7fd4d1f4c810] invalidated after a failed init tccd FORWARD: to=com.apple.tccd/0, request: { require_purpose=<xpc_null> service="kTCCServiceBluetoothAlways" function="TCCAccessRequest" preflight=true target_token={pid:76672, auid:-1, euid:0} TCCD_MSG_ID="169.49" background_session=false } tccd REPLY: from=com.apple.tccd, reply: { XPCErrorDescription="Connection invalid" } tccd forwardMessage error: Connection invalid.
1
0
126
1w
Any emulator for Mac Silicon?
As of now, there are some emulators available for the Apple Silicon Mac, such as Parallels Desktop and VMware Fusion. These emulators support virtualization on Apple Silicon and offer some support for ARM architecture. However, not all mobile applications or games have been adapted for Apple Silicon yet, so are there any emulators designed for moblie games fully adapted to Apple Silicon?
1
0
145
1w