I can't find any documentation on CGRequestPostEventAccess or its friend CGRequestListenEventAccess, except for the API declarations in CGEvent.h. The fact that it returns a boolean and doesn't have a completion callback or anything like that suggests that it should be synchronous, i.e., not return until the user has decided to grant or deny permission. Experimentally, that doesn't seem to be the case, but then what does the return value mean?
Selecting any option will automatically load the page
Post
Replies
Boosts
Views
Activity
According to the documentation of the NSApplicationActivateAllWindows flag of -[NSRunningApplication activateWithOptions:], "all of the application's windows are brought forward". That does not actually happen, and has not since at least macOS 10.15. It did work in macOS 10.13, don't know about 10.14. Is there any reasonable alternative to achieve the same effect?
The new environment constraints talk about a responsible process versus the launching process, but I'm not clear on the difference, and haven't been able to find a definition of a responsible process.
I'm building a plug-in for an app that I did not create, and I would like to notarize it. I know I can so that using notarytool, but it would be nice if I could do it using Xcode. However, when I archive, it creates a "generic Xcode archive". I've read TN3110: Resolving generic Xcode archive issue. Since the plugin is being created by itself rather than as part of a larger build product, I assume that I should use the SKIP_INSTALL = NO build setting. I am less sure of what to do with the INSTALL_PATH build setting. If I leave it empty, then nothing gets created in the Products folder of the archive. If I set it to some path, then the product is placed in the archive but nested in a subfolder of Products.
I'm updating some very old code, and it sends an kAESync Apple Event to the Finder to let Finder know that a file has been created or updated. Does this still serve a purpose? I know that Apple Events still exist, but creating the event involves deprecated things like FSRef and AliasHandle.
Possibly related: -[NSWorkspace noteFileSystemChanged:]. The documentation says that it informs the workspace object, so maybe it doesn't inform the Finder, and the documentation also says "Avoid calling this method if possible".
I just noticed that +[CIPlugIn loadAllPlugIns] has been deprecated since 10.15 (OK, I'm a little slow), along with all the other CIPlugIn methods except for loadNonExecutablePlugIns. I don't see any documentation about what I'm supposed to do instead. What's the deal?
Why is it that I can open a symbolic link, but can't read it? I am aware that I can get the contents of a symlink file using the readlink function, but still, it seems like this ought to work. Here's example code:
#include <iostream>
#include <unistd.h>
#include <fcntl.h>
int main(int argc, const char * argv[])
{
// Make sure there is not already a file where we will create the link
unlink( "/tmp/ReadSymLink-test" );
// Create a symlink
int result = symlink( "../usr", "/tmp/ReadSymLink-test");
int err;
if (result == 0)
{
std::cout << "created file /tmp/ReadSymLink-test\n";
}
else
{
err = errno;
std::cerr << "symlink failed with error " << err << "\n";
return 1;
}
// Open it for reading
int fd = open( "/tmp/ReadSymLink-test", O_RDONLY | O_SYMLINK );
if (fd < 0)
{
err = errno;
std::cerr << "open failed with error " << err << "\n";
return 2;
}
std::cout << "open succeeded\n";
// and read it
char buffer[200];
ssize_t bytesRead = read( fd, buffer, sizeof(buffer) );
if (bytesRead < 0)
{
err = errno;
std::cerr << "read failed with error " << err << "\n";
return 2;
}
else
{
buffer[ bytesRead ] = '\0';
std::cout << "read of symlink result: " << buffer << "\n";
}
return 0;
}
The result, running under Sonoma 14.2 (beta) is
created file /tmp/ReadSymLink-test
open succeeded
read failed with error 1
I replied to this thread a couple of hours ago, but the recent post list, sorted by Last Update, does not show it, and my watch list shows an update date based on a previous reply.
I want to be able to simulate mouse clicks, moves, and drags within my own app. I can do that using CGEventPost, but that requires accessibility permission, which seems silly to require when I'm not trying to control another app. An alternative is to create mouse NSEvents and use -[NSApplication postEvent:atStart:]. By that approach, I am able to click a button and watch it highlight and unhighlight, but the mouse cursor never moves and the pressedMouseButtons class property of NSEvent never changes. Is there a better way to simulate mouse events without requiring accessibility permission?
As an exercise in learning Swift, I rewrote a toy C++ command line tool in Swift. After switching to an UnsafeRawBufferPointer in a critical part of the code, the Release build of the Swift version was a little faster than the Release build of the C++ version. But the Debug build took around 700 times as long. I expect a Debug build to be somewhat slower, but by that much?
Here's the critical part of the code, a function that gets called many thousands of times. The two string parameters are always 5-letter words in plain ASCII (it's related to Wordle). By the way, if I change the loop ranges from 0..<5 to [0,1,2,3,4], then it runs about twice as fast in Debug, but twice as slow in Release.
func Score( trial: String, target: String ) -> Int
{
var score = 0
withUnsafeBytes(of: trial.utf8) { rawTrial in
withUnsafeBytes(of: target.utf8) { rawTarget in
for i in 0..<5
{
let trial_i = rawTrial[i];
if trial_i == rawTarget[i] // strong hit
{
score += kStrongScore
}
else // check for weak hit
{
for j in 0..<5
{
if j != i
{
let target_j = rawTarget[j];
if (trial_i == target_j) &&
(rawTrial[j] != target_j)
{
score += kWeakScore
break
}
}
}
}
}
}
}
return score
}
If I use [UTType exportedTypeWithIdentifier:] to get one of the types in my app's Info.plist, and then ask for the preferredFilenameExtension of that UTType, I get the wrong extension, i.e., not the first file extension listed for that UTI in my Info.plist. Is this one of those situations where AppKit is looking in some database that can get out of sync with what's actually in the Info.plist?
Topic:
UI Frameworks
SubTopic:
AppKit
I made a new app icon with Icon Composer, and added it to my Xcode project. In the built app, I see AppIcon.icon next to the old AppIcon.icns. But Tahoe is not showing the new icon. Is this because Tahoe has cached the old icon somewhere, and if so, is there some way to make it refresh?
I have some working Objective-C code that displays a WKWebView and allows printing that content. However, it uses the method -[WKWebView printOperationWithPrintInfo:], which the documentation says is deprecated as of macOS 10.15. However, it doesn't say why this method is deprecated, or what the recommended replacement is. The declaration in WKWebView.h does not even indicate that the method is deprecated. But as an alternative, I tried using +[NSPrintOperation printOperationWithView:printInfo]. Doing it that way just prints a blank page. So, should I keep doing it the doubtful way?
When I tried turning on ENABLE_ENHANCED_SECURITY = YES in an Xcode 26.1 beta project, I got a bunch of "module file not found" errors like this:
While building module 'CoreServices':
In file included from <module-includes>:1:
/Applications/Xcode26.1-beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks/CoreServices.framework/Headers/CoreServices.h:19:2: fatal error: module file '/Volumes/Work/Xcode-derived/PlainCalc3-gixjfymjqamwmufdwcseugzjehqa/Build/Intermediates.noindex/ExplicitPrecompiledModules/CoreFoundation-5POB3HW0BHFSPWLD7DOOKAULM.pcm' not found: module file not found
19 | #include <CoreFoundation/CoreFoundation.h>
| ^
I tried deleting the project's derived data.
Is this a known issue?
I've recently switched from using Xcode 15 under Ventura to using Xcode 26 under Sequoia on an Intel-CPU Mac. This is a macOS project that uses a legacy build location, and the sources are C++ and Objective-C. For every source being compiled, I get a clang warning "no such include directory" for these 4 directories:
$BUILD_DIR/Debug/include
$BUILD_DIR/SBEngineV4.build/Debug/V4 Dual SBEngine.build/DerivedSources-normal/x86_64
$BUILD_DIR/SBEngineV4.build/Debug/V4 Dual SBEngine.build/DerivedSources/x86_64
$BUILD_DIR/SBEngineV4.build/Debug/V4 Dual SBEngine.build/DerivedSources
I can't figure out where it's getting those directories. I added a Run Script build phase that says echo $HEADER_SEARCH_PATHS, and the first path that reports is the $BUILD_DIR/Debug/include path, yet I don't see that when I look at the header search paths in the target build settings.
I tried deleting all the derived data. I tried Xcode 26.0.1 and 26.1 beta 2.