Post

Replies

Boosts

Views

Activity

Reply to Any advices for a new kid coming to Apple development?
I can't really answer your specific questions, but I would remark that macOS has multiple layers coming from different eras, somewhat like an archeological dig. Some of the newest APIs can only be used with Apple's new favorite language, Swift. Dig a little deeper and you find lots of APIs designed for use with Objective-C (though they can be used with Swift too.) Below that, there are POSIX APIs coming from the FreeBSD heritage of Mac OS X. And there are still a few working APIs that date back to the pre-Mac OS X days. As a result, there are often multiple ways of accomplishing a given task, such as networking.
Topic: App & System Services SubTopic: Core OS Tags:
Dec ’22
Reply to How to track the key press events of keyboard using SwiftUI for MacOS?
The documentation says Key-related events may only be monitored if accessibility is enabled or if your application is trusted for accessibility access (see AXIsProcessTrusted). See also AXIsProcessTrustedWithOptions and the newer APIs CGPreflightListenEventAccess and CGRequestListenEventAccess. For instance, when you program is starting up, you might call CGPreflightListenEventAccess, and if that returns false, call CGRequestListenEventAccess.
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Dec ’22
Reply to Unable to notarize app due to wrong libomp.dylib library signature
I'm not sure if this is the problem, but the location of the dylib in your bundle is peculiar. For one thing, the Resources folder is not one of the standard locations for nested code, according to the macOS Code Signing in Depth technote. Also, that document says The code signing machinery interprets directories with periods in their names as code bundles and will reject them if they don't conform to the expected code bundle layout. so that ".dylibs" folder could be a problem.
Topic: Code Signing SubTopic: Notarization Tags:
Dec ’22
Reply to How is CGRequestPostEventAccess supposed to work?
Experimentally, CGRequestPostEventAccess is not synchronous. Even if it has opened an alert offering to take the user to System Settings to grant access, it returns NO in a millisecond or so. I was also confused by the fact that the related function CGPreflightPostEventAccess just seems to report the access that the process had when it launched, even if the access shown in System Settings changed while the process was running. That was beginning to make me believe that changes in trust while a process is running don't affect the process at all, but that seems not to be the case: If an agent is initially trusted to post events, and installs an event tap, but trust is revoked while it's running, then the Mac becomes mostly unresponsive to keyboard events. I've submitted FB11832484 requesting documentation on these APIs. Note that the framework prevents you from requesting multiple times. I'm guessing you mean that repeated calls to CGRequestPostEventAccess will silently fail, but please let me know if there is some other form of "prevention".
Dec ’22