I have created the feedback assistant ticket:
This is the reference:
Raul Sanchez
Sep 11, 2023 at 12:28 PM – FB13151229
Post
Replies
Boosts
Views
Activity
I have tested the app signing the code and result is the same. It does not work. Can someone help me, please? To me it seems quite important bug. API does not work as described
Bringing up this thread again. Using XCode and launching the binary from there, shows same problem
Can that be Apple bug?
That maybe the case since it is test application developed by myself to test behaviour of that. Can I expect odd behaviour even in my local laptop?
No ideas? Hasn't anyone else seen this problem ?
No ideas here? I am quite interested in finding out the root of this problem
Hello,I am using that !! in order to convert Boolean type to bool
This is the complete example in Obj-C. Just in case you see something://
// main.m
// ScreenshotTest
//
// Created by Raul Sanchez on 24/12/2019.
// Copyright © 2019 Raul Sanchez. All rights reserved.
//
#import <Foundation/Foundation.h>
#import <CoreVideo/CVPixelFormatDescription.h>
void showPopupIfNotSCreenRecording()
{
CGDisplayStreamRef stream =
CGDisplayStreamCreate(CGMainDisplayID(), 1, 1, kCVPixelFormatType_32BGRA, nil,
^(CGDisplayStreamFrameStatus status, uint64_t displayTime, IOSurfaceRef frameSurface, CGDisplayStreamUpdateRef updateRef) {});
if (stream)
CFRelease(stream);
}
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(@"Lets try this");
showPopupIfNotSCreenRecording();
checkIfAccessibilityEnabledAndDisplayPopup();
NSLog(@"End of program");
}
return 0;
}
Hello,Sorry for the late reply. I Have two functions which are called consecutively. Here is the code:void MacUtils::checkIfScreenRecordingEnabledShowPopupIfNot()
{
qInfo() << "MacUtils::checkIfScreenRecordingEnabledShowPopupIfNot()";
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);
}
bool MacUtils::checkIfAccessibilityEnabledAndDisplayPopup()
{
// Method to check if accessibility is enabled
// Passing YES to kAXTrustedCheckOptionPrompt forces showing popup
NSDictionary *options = @{(id)kAXTrustedCheckOptionPrompt: @YES};
Boolean accessibilityEnabled = AXIsProcessTrustedWithOptions((CFDictionaryRef)options);
return (!!accessibilityEnabled);
}First method is for screen recording permission, second one is for accessibilityIf i call first method I see the popup asking for screen recording permissions but then I dont see accesibility popup and if I go to privacy menu it appears like if I had denied permission (app unchecked)Do you have an idea how I can solve this?Thanks in advance
Finally modifying the entitlements added when signing fixed this issue
No ideas or replies to this??? Is anyone else seeing this ?
Here is method implementation:CGEventRef
myCGEventCallback(CGEventTapProxy proxy, CGEventType type,
CGEventRef event, void *refcon)
{
if ((type != kCGEventKeyDown) && (type != kCGEventKeyUp))
return event;
qDebug() << "callback called!";
return event;
}Any idea why this may happen?Thanks
didToggleAccessStatus so far only prints a message. I think problem is related to run loops. Application does not really hang because I added log to print when key event and it gets printed, but laptop stop responding to mouse events. I can move mouse only but clicks don't work.Please could someone explain to me what may happen?Thanks