, it is after update to Xcode 14.3:
[default] CGSWindowShmemCreateWithPort failed on port 0
, it is after update to Xcode 14.3:
[default] CGSWindowShmemCreateWithPort failed on port 0
Update to Xcode 14.3 from which version ?
Is it in a SwiftUI app ?
If so, could you show your app file:
@main
struct MyApp: App {
}
Please give more context.
Happens with my app too on macOS (Ventura 13.3 (22E252), Xcode Version 14.3 (14E222b)). My app is a SwiftUI app.
This is printed in the log every time I close a sheet opened from a View. Doesn't matter if the sheet is closed by pressing a button on view (dismiss()
is called) or by pressing esc on keyboard.
App file looks like this, if that matters:
import SwiftUI
@main
struct MyBlahBlahApp: App {
var body: some Scene {
WindowGroup {
ContentView()
.environment(\.managedObjectContext, BlahBlahContainer.shared.persistentContainer.viewContext)
}
}
}
Yeah, this message constantly popping up during debug is a new normal since Ventura 13.3. Does not seem to affect anything though and things work just fine.
Please see On Log Noise to determine your next steps for these console logs.
The program might be using a deprecated API, such as NSCountWindows
which can cause that os_log message to appear in the console.
Try compiling with -Wdeprecated-declarations
enabled, and clean up the code that is using deprecated APIs.
Alternatively, in your lldb, you can set a breakpoint (lldb) b libsystem_trace.dylib``_os_log_error_impl
(only one backtick; concession to the forum formatting) and when that gets hit you can look up the callstack to figure out what in your code triggered the os_log message.
I'm seeing the same messages during debug of my objective-c Mac app. This started appearing after some macOS/Xcode update.
I'm facing the same messages during debug of my swift Mac app which use the storyboard. I would like to know if anyone solved it ?
my game just started doing this on the newest xcode beta
I had this, caused by this:
NrofWindows = [[NSWindow windowNumbersWithOptions:NSWindowNumberListAllApplications|NSWindowNumberListAllSpaces] count];
Doc says: "If you pass 0 instead, then the list the method returns contains window numbers for visible windows on the active space belonging to the calling application"
As that is what I actually need, changed the value to 0:
NrofWindows = [[NSWindow windowNumbersWithOptions:0] count];
And the log msg vanished.
Thanks Eljay Adobe for the breakpoint command.
rick
In another thread someone asked for clarification as to how to set this breakpoint. I decided to share that here to make it easier to find.
The breakpoint suggested by Eljay Adobe upthread is a symbolic breakpoint on an implementation detail within the system log subsystem. To try this out:
Create a new project from the macOS > Command Line Tool template, choosing Objective-C as the language [1].
Replace main.m
with the code shown below.
Choose Product > Run, just to make sure it works.
Choose View > Navigators > Breakpoints.
At the bottom left, click the add (+) button and choose Symbolic Breakpoint.
Enter _os_log_error_impl
into the Symbol field.
Choose Product > Run. You’ll stop at the breakpoint with a backtrace like this:
(lldb) bt
* thread #1, stop reason = breakpoint 1.1
* frame #0: 0x000000019fe8424c libsystem_trace.dylib`_os_log_error_impl
frame #1: 0x0000000100003f30 Test774550c`main(argc=1, argv=0x000000016fdff520) at main.m:5:5
frame #2: 0x000000019fdb0274 dyld`start + 2840
Once you have this working, you can apply the same technique in your real project.
IMPORTANT Playing around with implementation details like this is great while debugging, but don’t encode such details into a product that you ship to a wide range of users.
Share and Enjoy
—
Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"
[1] Swift’s logging infrastructure (Logger
) is implemented in a different way, so these instructions won’t work if you use that.
@import Foundation;
@import os.log;
int main(int argc, char **argv) {
os_log_error(OS_LOG_DEFAULT, "");
return EXIT_SUCCESS;
}