Post

Replies

Boosts

Views

Activity

How to get PID from AudioObjectID on macOS pre Sonoma
3 I am working on an application to get when input audio device is being used. Basically I want to know the application using the microphone (built-in or external) This app runs on macOS. For Mac versions starting from Sonoma I can use this code: int getAudioProcessPID(AudioObjectID process) { pid_t pid; if (@available(macOS 14.0, *)) { constexpr AudioObjectPropertyAddress prop { kAudioProcessPropertyPID, kAudioObjectPropertyScopeGlobal, kAudioObjectPropertyElementMain }; UInt32 dataSize = sizeof(pid); OSStatus error = AudioObjectGetPropertyData(process, &prop, 0, nullptr, &dataSize, &pid); if (error != noErr) { return -1; } } else { // Pre sonoma code goes here } return pid; } which works. However, kAudioProcessPropertyPID was added in macOS SDK 14.0. Does anyone know how to achieve the same functionality on previous versions?
1
0
362
Sep ’25
base::SequencedTaskRunnerHandle::Get crash on macOS while calling NSAccessibilityGetObjectValueForAttribute
Hello all, I have an application which retrieves URL from browser using accessibility. From time to time I am having this crash and I don't know the reason for it. Could you please help me? This is the stacktrace: It is happening on MacOS 13.5 and it happens on an application built for x86_64 and arm64
2
0
697
Sep ’23
Error adding app to login items using SMAppService
Hello all, I am trying to use the new SMAppService added in MacOS Ventura to add my app to login items. This is the code I am using: if (@available(macOS 13.0, *)) { SMAppService* service = [SMAppService mainAppService]; NSError* error = nil; BOOL output = false; if (setEnabled) output = [service registerAndReturnError:&error]; else output = [service unregisterAndReturnError:&error]; } However when I run the app I see this error: Domain=SMAppServiceErrorDomain Code=1 "Operation not permitted" UserInfo={NSLocalizedFailureReason=Operation not permitted} 2022-12-25 11:14:16.628 TimeDoctor2[16823:159849] Error adding or removing item Error Domain=SMAppServiceErrorDomain Code=1 "Operation not permitted" UserInfo={NSLocalizedFailureReason=Operation not permitted} I have tried to check the error detail using this command on another terminal tab: sudo log stream --debug --info --predicate "process in { '<my process>', 'smd', 'backgroundtaskmanagementd'} and sender in {'ServiceManagement', 'BackgroundTaskManagement', 'smd', 'backgroundtaskmanagementd'}" I don´t really understand the output: Filtering the log data using "process IN {"<my process>", "smd", "backgroundtaskmanagementd"} AND sender IN {"ServiceManagement", "BackgroundTaskManagement", "smd", "backgroundtaskmanagementd"}" Timestamp            Thread   Type    Activity       PID  TTL   2022-12-25 11:01:57.444537+0100 0x25272  Activity  0x514e0       306  0  smd: (BackgroundTaskManagement) BTMManager.getEffectiveDisposition 2022-12-25 11:01:57.445383+0100 0x25271  Default   0x514e0       491  0  backgroundtaskmanagementd: [com.apple.backgroundtaskmanagement:main] effectiveItemDisposition: appURL=<private>, type=app, url=(null), config=(null) 2022-12-25 11:01:57.452448+0100 0x25272  Error    0x514e0       306  0  smd: (BackgroundTaskManagement) [com.apple.backgroundtaskmanagement:main] getEffectiveDisposition: error: Error Domain=BTMErrorDomain Code=-98 "(null)" 2022-12-25 11:01:57.452479+0100 0x25272  Error    0x0         306  0  smd: [com.apple.xpc.smd:SMAppService] Unable to get disposition of item: <private> error: Error Domain=NSPOSIXErrorDomain Code=3 2022-12-25 11:01:57.452378+0100 0x25271  Error    0x514e0       491  0  backgroundtaskmanagementd: [com.apple.backgroundtaskmanagement:main] effectiveItemDisposition: failed to construct identifier with parameters: appURL=/Applications/Time Doctor 2.app, url=(null), type=app, config=(null) 2022-12-25 11:01:57.452495+0100 0x25272  Default   0x0         306  0  smd: [com.apple.xpc.smd:all] Found status: 3 for <private> 2022-12-25 11:01:57.842135+0100 0x25534  Activity  0x514e1       306  0  smd: (BackgroundTaskManagement) BTMManager.getEffectiveDisposition 2022-12-25 11:01:57.842254+0100 0x25271  Default   0x514e1       491  0  backgroundtaskmanagementd: [com.apple.backgroundtaskmanagement:main] effectiveItemDisposition: appURL=<private>, type=app, url=(null), config=(null) 2022-12-25 11:01:57.849707+0100 0x25271  Error    0x514e1       491  0  backgroundtaskmanagementd: [com.apple.backgroundtaskmanagement:main] effectiveItemDisposition: failed to construct identifier with parameters: appURL=/Applications/Time Doctor 2.app, url=(null), type=app, config=(null) 2022-12-25 11:01:57.849804+0100 0x25534  Error    0x514e1       306  0  smd: (BackgroundTaskManagement) [com.apple.backgroundtaskmanagement:main] getEffectiveDisposition: error: Error Domain=BTMErrorDomain Code=-98 "(null)" 2022-12-25 11:01:57.849828+0100 0x25534  Error    0x0         306  0  smd: [com.apple.xpc.smd:SMAppService] Unable to get disposition of item: <private> error: Error Domain=NSPOSIXErrorDomain Code=3 2022-12-25 11:01:57.849839+0100 0x25534  Default   0x0         306  0  smd: [com.apple.xpc.smd:all] Found status: 3 for <private> 2022-12-25 11:01:58.020633+0100 0x25534  Activity  0x514e2       306  0  smd: (BackgroundTaskManagement) BTMManager.getEffectiveDisposition 2022-12-25 11:01:58.020762+0100 0x25271  Default   0x514e2       491  0  backgroundtaskmanagementd: [com.apple.backgroundtaskmanagement:main] effectiveItemDisposition: appURL=<private>, type=app, url=(null), config=(null) 2022-12-25 11:01:58.025436+0100 0x25534  Error    0x514e2       306  0  smd: (BackgroundTaskManagement) [com.apple.backgroundtaskmanagement:main] getEffectiveDisposition: error: Error Domain=BTMErrorDomain Code=-98 "(null)" 2022-12-25 11:01:58.025334+0100 0x25271  Error    0x514e2       491  0  backgroundtaskmanagementd: [com.apple.backgroundtaskmanagement:main] effectiveItemDisposition: failed to construct identifier with parameters: appURL=/Applications/Time Doctor 2.app, url=(null), type=app, config=(null) 2022-12-25 11:01:58.304370+0100 0x25271  Error    0x514e4       491  0  backgroundtaskmanagementd: [com.apple.backgroundtaskmanagement:main] effectiveItemDisposition: failed to construct identifier with parameters: appURL=/Applications/Time Doctor 2.app, url=(null), type=app, config=(null) Could someone help me please?
1
0
1.3k
Dec ’22
Explore accessibility structure using NSAccessibility
Hello all, I have an application which explores accessibility structure. It is something similar to what Accessibility Inspector does. I have developed it using the old API. Using functions like AXUIElementCreateApplication or AXUIElementCopyAttributeValue and having to deal with pointers manually. Would it be possible to rewrite that code using NSAccessibility? I have read some doc about it but it seems it is designed to set accessibility in your OWN application, not for retrieving accessibility from external application.
1
0
1k
Jul ’21
How to get PID from AudioObjectID on macOS pre Sonoma
3 I am working on an application to get when input audio device is being used. Basically I want to know the application using the microphone (built-in or external) This app runs on macOS. For Mac versions starting from Sonoma I can use this code: int getAudioProcessPID(AudioObjectID process) { pid_t pid; if (@available(macOS 14.0, *)) { constexpr AudioObjectPropertyAddress prop { kAudioProcessPropertyPID, kAudioObjectPropertyScopeGlobal, kAudioObjectPropertyElementMain }; UInt32 dataSize = sizeof(pid); OSStatus error = AudioObjectGetPropertyData(process, &amp;prop, 0, nullptr, &amp;dataSize, &amp;pid); if (error != noErr) { return -1; } } else { // Pre sonoma code goes here } return pid; } which works. However, kAudioProcessPropertyPID was added in macOS SDK 14.0. Does anyone know how to achieve the same functionality on previous versions?
Replies
1
Boosts
0
Views
362
Activity
Sep ’25
base::SequencedTaskRunnerHandle::Get crash on macOS while calling NSAccessibilityGetObjectValueForAttribute
Hello all, I have an application which retrieves URL from browser using accessibility. From time to time I am having this crash and I don't know the reason for it. Could you please help me? This is the stacktrace: It is happening on MacOS 13.5 and it happens on an application built for x86_64 and arm64
Replies
2
Boosts
0
Views
697
Activity
Sep ’23
App Store deploy updates for certain users
Hello all, I have an application and I am considering it to publish it on App Store. I would like to have the possibility of releasing updates for some IDs only (each user would belong to an organization with unique ID). Is that possible on App Store? Thanks!
Replies
0
Boosts
0
Views
410
Activity
Apr ’23
Don't show "Backgound Item Added" notification
Hello all, I am working on an application which will work as daemon for the user. With the update to Ventura I have seen that notification when daemons are installed is displayed. is there any way to add code to prevent that notification to show up? Thanks!
Replies
2
Boosts
0
Views
808
Activity
Mar ’23
Error adding app to login items using SMAppService
Hello all, I am trying to use the new SMAppService added in MacOS Ventura to add my app to login items. This is the code I am using: if (@available(macOS 13.0, *)) { SMAppService* service = [SMAppService mainAppService]; NSError* error = nil; BOOL output = false; if (setEnabled) output = [service registerAndReturnError:&error]; else output = [service unregisterAndReturnError:&error]; } However when I run the app I see this error: Domain=SMAppServiceErrorDomain Code=1 "Operation not permitted" UserInfo={NSLocalizedFailureReason=Operation not permitted} 2022-12-25 11:14:16.628 TimeDoctor2[16823:159849] Error adding or removing item Error Domain=SMAppServiceErrorDomain Code=1 "Operation not permitted" UserInfo={NSLocalizedFailureReason=Operation not permitted} I have tried to check the error detail using this command on another terminal tab: sudo log stream --debug --info --predicate "process in { '<my process>', 'smd', 'backgroundtaskmanagementd'} and sender in {'ServiceManagement', 'BackgroundTaskManagement', 'smd', 'backgroundtaskmanagementd'}" I don´t really understand the output: Filtering the log data using "process IN {"<my process>", "smd", "backgroundtaskmanagementd"} AND sender IN {"ServiceManagement", "BackgroundTaskManagement", "smd", "backgroundtaskmanagementd"}" Timestamp            Thread   Type    Activity       PID  TTL   2022-12-25 11:01:57.444537+0100 0x25272  Activity  0x514e0       306  0  smd: (BackgroundTaskManagement) BTMManager.getEffectiveDisposition 2022-12-25 11:01:57.445383+0100 0x25271  Default   0x514e0       491  0  backgroundtaskmanagementd: [com.apple.backgroundtaskmanagement:main] effectiveItemDisposition: appURL=<private>, type=app, url=(null), config=(null) 2022-12-25 11:01:57.452448+0100 0x25272  Error    0x514e0       306  0  smd: (BackgroundTaskManagement) [com.apple.backgroundtaskmanagement:main] getEffectiveDisposition: error: Error Domain=BTMErrorDomain Code=-98 "(null)" 2022-12-25 11:01:57.452479+0100 0x25272  Error    0x0         306  0  smd: [com.apple.xpc.smd:SMAppService] Unable to get disposition of item: <private> error: Error Domain=NSPOSIXErrorDomain Code=3 2022-12-25 11:01:57.452378+0100 0x25271  Error    0x514e0       491  0  backgroundtaskmanagementd: [com.apple.backgroundtaskmanagement:main] effectiveItemDisposition: failed to construct identifier with parameters: appURL=/Applications/Time Doctor 2.app, url=(null), type=app, config=(null) 2022-12-25 11:01:57.452495+0100 0x25272  Default   0x0         306  0  smd: [com.apple.xpc.smd:all] Found status: 3 for <private> 2022-12-25 11:01:57.842135+0100 0x25534  Activity  0x514e1       306  0  smd: (BackgroundTaskManagement) BTMManager.getEffectiveDisposition 2022-12-25 11:01:57.842254+0100 0x25271  Default   0x514e1       491  0  backgroundtaskmanagementd: [com.apple.backgroundtaskmanagement:main] effectiveItemDisposition: appURL=<private>, type=app, url=(null), config=(null) 2022-12-25 11:01:57.849707+0100 0x25271  Error    0x514e1       491  0  backgroundtaskmanagementd: [com.apple.backgroundtaskmanagement:main] effectiveItemDisposition: failed to construct identifier with parameters: appURL=/Applications/Time Doctor 2.app, url=(null), type=app, config=(null) 2022-12-25 11:01:57.849804+0100 0x25534  Error    0x514e1       306  0  smd: (BackgroundTaskManagement) [com.apple.backgroundtaskmanagement:main] getEffectiveDisposition: error: Error Domain=BTMErrorDomain Code=-98 "(null)" 2022-12-25 11:01:57.849828+0100 0x25534  Error    0x0         306  0  smd: [com.apple.xpc.smd:SMAppService] Unable to get disposition of item: <private> error: Error Domain=NSPOSIXErrorDomain Code=3 2022-12-25 11:01:57.849839+0100 0x25534  Default   0x0         306  0  smd: [com.apple.xpc.smd:all] Found status: 3 for <private> 2022-12-25 11:01:58.020633+0100 0x25534  Activity  0x514e2       306  0  smd: (BackgroundTaskManagement) BTMManager.getEffectiveDisposition 2022-12-25 11:01:58.020762+0100 0x25271  Default   0x514e2       491  0  backgroundtaskmanagementd: [com.apple.backgroundtaskmanagement:main] effectiveItemDisposition: appURL=<private>, type=app, url=(null), config=(null) 2022-12-25 11:01:58.025436+0100 0x25534  Error    0x514e2       306  0  smd: (BackgroundTaskManagement) [com.apple.backgroundtaskmanagement:main] getEffectiveDisposition: error: Error Domain=BTMErrorDomain Code=-98 "(null)" 2022-12-25 11:01:58.025334+0100 0x25271  Error    0x514e2       491  0  backgroundtaskmanagementd: [com.apple.backgroundtaskmanagement:main] effectiveItemDisposition: failed to construct identifier with parameters: appURL=/Applications/Time Doctor 2.app, url=(null), type=app, config=(null) 2022-12-25 11:01:58.304370+0100 0x25271  Error    0x514e4       491  0  backgroundtaskmanagementd: [com.apple.backgroundtaskmanagement:main] effectiveItemDisposition: failed to construct identifier with parameters: appURL=/Applications/Time Doctor 2.app, url=(null), type=app, config=(null) Could someone help me please?
Replies
1
Boosts
0
Views
1.3k
Activity
Dec ’22
Explore accessibility structure using NSAccessibility
Hello all, I have an application which explores accessibility structure. It is something similar to what Accessibility Inspector does. I have developed it using the old API. Using functions like AXUIElementCreateApplication or AXUIElementCopyAttributeValue and having to deal with pointers manually. Would it be possible to rewrite that code using NSAccessibility? I have read some doc about it but it seems it is designed to set accessibility in your OWN application, not for retrieving accessibility from external application.
Replies
1
Boosts
0
Views
1k
Activity
Jul ’21