Post

Replies

Boosts

Views

Activity

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
590
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.1k
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
941
Jul ’21
CoreFoundation Framework debug info (dsym file)
Hello all, I am debugging core saved in minidump format. After running minidumpstackwalk command in the output I see these messages: 2020-09-06 11:00:14: stackwalker.cc:103: INFO: Couldn't load symbols for: libsystemkernel.dylib|2B6311E662403EF78C87475B66F7452C0 2020-09-06 11:00:14: simplesymbolsupplier.cc:196: INFO: No symbol file at sym/CoreFoundation/C0D70026EDBE3CBDB317367CF4F1C92F0/CoreFoundation.sym 2020-09-06 11:00:14: stackwalker.cc:103: INFO: Couldn't load symbols for: CoreFoundation|C0D70026EDBE3CBDB317367CF4F1C92F0 2020-09-06 11:00:14: simplesymbolsupplier.cc:196: INFO: No symbol file at sym/HIToolbox/DE6F9A208AF7396382E14756C4A7A54C0/HIToolbox.sym 2020-09-06 11:00:14: stackwalker.cc:103: INFO: Couldn't load symbols for: HIToolbox|DE6F9A208AF7396382E14756C4A7A54C0 2020-09-06 11:00:14: simplesymbolsupplier.cc:196: INFO: No symbol file at sym/AppKit/C420864219F73EAAAACD3B836FFDEFCF0/AppKit.sym 2020-09-06 11:00:14: stackwalker.cc:103: INFO: Couldn't load symbols for: AppKit|C420864219F73EAAAACD3B836FFDEFCF0 I would need to have DSYM files for those frameworks in order to get symbols. However I have checked here: /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk/System/Library/Frameworks and I only see the release version of those frameworks. Where could I get debug versions? Or should I generate them? Thanks and regards
0
0
1.1k
Sep ’20
Call to AXIsProcessTrustedWithOptions does not work after change setting manually
Hello all I am testing accessibility permissions using AXIsProcessTrustedWithOptions When app starts value is correctly returned. However if I change the setting in System Preferences -> Security &amp; Privacy while app is running call to API is still returning the previous value. Is that bug? Here is example code: bool checkIfAccessibilityEnabledAndDisplayPopup() {   // Method to check if accessibility is enabled   // Passing YES to kAXTrustedCheckOptionPrompt forces showing popup   NSDictionary *options = @{(__bridge id)kAXTrustedCheckOptionPrompt: @YES};   Boolean accessibilityEnabled = AXIsProcessTrustedWithOptions((CFDictionaryRef)options);   return (!!accessibilityEnabled); } int main(int argc, const char * argv[]) {   @autoreleasepool {     NSLog(@"Starting");     for (int i=0;i<100;++i) {        checkIfAccessibilityEnabledAndDisplayPopup();        [NSThread sleepForTimeInterval:20.0f];        NSDictionary *options = @{(__bridge id)kAXTrustedCheckOptionPrompt: @NO};        Boolean b = AXIsProcessTrustedWithOptions((CFDictionaryRef)options);        Boolean b1 = AXIsProcessTrusted();        NSLog(@"accessibility AXIsProcessTrustedWithOptions--> %d AXIsProcessTrusted ---> %d", b, b1);     } }
6
0
1.9k
Jun ’20
Library not loaded … code signing blocked on macos 10.15.4
Hello,I am getting an error when running my app on macos 10.15.4The error is:dyld: Library not loaded: @rpath/Frameworks/libQt5Solutions_SingleApplication-head.1.dylib Referenced from: /Users/raulsanchez/Documents/workspace/Myapp.app/Contents/MacOS/Myapp Reason: no suitable image found. Did find: /Users/raulsanchez/Documents/workspace/Myapp.app/Contents/MacOS/../Frameworks/libQt5Solutions_SingleApplication-head.1.dylib: code signing blocked mmap() of '/Users/raulsanchez/Documents/workspace/Myapp.app/Contents/MacOS/../Frameworks/libQt5Solutions_SingleApplication-head.1.dylib' /Users/raulsanchez/Documents/workspace/Myapp.app/Contents/MacOS/../Frameworks/libQt5Solutions_SingleApplication-head.1.dylib: stat() failed with errno=1 zsh: abort I have deleted and reinstalled my certificate but still same error. I don't see any error while signing the applicationThe command I am using for signing is:codesign -v --force --verify --deep --sign &lt;certificate&gt; --timestamp --options runtime &lt;app&gt;Any ideas please?Thanks in advance
3
0
1.4k
Apr ’20
Display several system popups cocoa application
I have Cocoa application where I need to ask for recording and accessibility permission. I am seeing that only first feature asking for permissions shows its popup.E.g If I put first code to ask for recording screen permission I dont see accessibility and in the Security and Privacy my app appears as I had rejected permissionSame happens on the other way around.This is the code to request screen recording:CGDisplayStreamRef stream = CGDisplayStreamCreate(CGMainDisplayID(), 1, 1, kCVPixelFormatType_32BGRA, nil, ^(CGDisplayStreamFrameStatus status, uint64_t displayTime, IOSurfaceRef frameSurface, CGDisplayStreamUpdateRef updateRef) { Q_UNUSED(status) Q_UNUSED(displayTime) Q_UNUSED(frameSurface) Q_UNUSED(updateRef) }); if (stream) CFRelease(stream);And this is the code for accessibilityNSDictionary *options = @{(id)kAXTrustedCheckOptionPrompt: @YES}; Boolean accessibilityEnabled = AXIsProcessTrustedWithOptions((CFDictionaryRef)options);How can I fix this, please?Thanks in advance and regards
7
0
1.4k
Mar ’20
Macos Application hangs when using NSDistributedNotificationCenter and CFRunLoopAddSource
Hello all:I have MacOS application built using Qt. There I have created NSDistributedNotificationCenter to be notified when accessibility settings change (observing "com.apple.accessibility.api" ). Also I have CFRunLoopAddSource to monitor key pressed events.However when I run the program and I change accessibility application hangs and I cannot run it normally.Could someone help to see why that is happening?This is the code:Here I am creating observer: Creation/deletion is controlled by button click- (void)createObserver { [[NSDistributedNotificationCenter defaultCenter] addObserver:self selector:@selector(didToggleAccessStatus:) name:@"com.apple.accessibility.api" object:nil suspensionBehavior:NSNotificationSuspensionBehaviorDeliverImmediately]; }And this is how I add key event logger:// Create an event tap to retrieve keypresses. CGEventMask eventMask = (CGEventMaskBit(kCGEventKeyDown) | CGEventMaskBit(kCGEventFlagsChanged) | CGEventMaskBit(kCGEventLeftMouseDown) | CGEventMaskBit(kCGEventRightMouseDown) | CGEventMaskBit(kCGEventMouseMoved) | CGEventMaskBit(kCGEventScrollWheel)); //| CGEventMaskBit(kCGEventLeftMouseDragged) //| CGEventMaskBit(kCGEventRightMouseDragged) //| CGEventMaskBit(kCGEventOtherMouseDragged);); CFMachPortRef m_eventTap = nullptr; CFRunLoopSourceRef m_runLoopSource = nullptr; m_eventTap = CGEventTapCreate( kCGSessionEventTap, kCGHeadInsertEventTap, kCGEventTapOptionDefault, eventMask, myCGEventCallback, nullptr); if (m_eventTap != Q_NULLPTR) { NSLog(@"CGEventTap created"); // Create a run loop source and add enable the event tap. m_runLoopSource = CFMachPortCreateRunLoopSource(kCFAllocatorDefault, m_eventTap, 0); CFRunLoopAddSource(CFRunLoopGetCurrent()/*CFRunLoopGetMain()*/, m_runLoopSource, kCFRunLoopCommonModes); CGEventTapEnable(m_eventTap, true); //CFRunLoopRun(); } else { m_runLoopSource = Q_NULLPTR; NSLog(@"Error creating CGEventTap"); }Any ideas about what is going on there? And how can I solve thatThanks in advance and regards
6
0
1.6k
Feb ’20