Post

Replies

Boosts

Views

Activity

Core Image content filters broken in Big Sur
When I try to use custom Core Image filters in the contentFilters property of an NSView, they don't work in Big Sur (as of 11.0.1 beta). They do work in Catalina. Doesn't matter if they're written using Metal or Core Image Kernel Language. I've reported this as a bug, but I'm wondering if there is some trick or workaround.
2
0
1.3k
Feb ’22
Can defaults command on macOS read app group preferences?
Is there any way to read/write preferences for a Mac app group using the defaults command? I'm talking about the stuff you would programmatically manipulate using [NSUserDefaults initWithSuiteName:], and that is stored on disk in ~/Library/Group Containers. If I just say defaults read <suite name>, it tells me the the domain does not exist.
5
1
2.7k
Oct ’23
Why would event tap creation fail?
On my Mac (running Ventura), so long as my app is granted accessibility permission in System Settings > Privacy & Security > Accessibility, I am able to create a global event tap like so: CFMachPortRef thePort = CGEventTapCreate( kCGAnnotatedSessionEventTap, kCGTailAppendEventTap, kCGEventTapOptionDefault, // active filter CGEventMaskBit(kCGEventKeyDown), CTapListener::MyTapCallback, NULL ); But on a user's computer, also running Ventura, the CGEventTapCreate call is apparently returning NULL, even though he's showing me a screen shot of the accessibility permission being turned on. Any ideas what I could be missing, or how to debug it?
0
0
1.1k
Jan ’23
Xcode script build phase error involving output file
I have a run script build phase that is trying to do custom code signing of a helper tool after it has been copied into the app package, so I have set both input and output files to the same thing, ${CONFIGURATION_BUILD_DIR}/$CONTENTS_FOLDER_PATH/Helpers/V40SSApp. But when I try to build, I get an error invalid task ('PhaseScriptExecution Run\ Script /mypath/Debug/installer.build/Script-BED5B762297F4C4C00C96242.sh') with mutable output but no other virtual output node I would guess that the "mutable" bit has something to do with the input and output being the same, but I don't get what it's complaining about.
1
2
910
Jan ’23
ENABLE_USER_SCRIPT_SANDBOXING in Xcode 14
Anyone have more understanding of how this is supposed to work , beyond the quick help "If enabled, the build system will sandbox user scripts to disallow undeclared input/output dependencies."? When I turned it on, one of my build scripts failed. Operation not permitted error: Sandbox: bash(29174) deny(1) file-read-data In this case, the input path is to a folder (a framework) and the output path is in the build directory. The paths are definitely correct, because the script accesses them as $SCRIPT_INPUT_FILE_0 and $SCRIPT_OUTPUT_FILE_0, so the script wouldn't work at all if I had an error in the paths. I tried putting a slash at the end of an input path, and then the error was just "operation not permitted", without mentioning the sandbox.
2
2
8.6k
Jun ’22
defaults tool can't handle app group settings?
I have an app group to share settings between a main app and a helper. This is accessed using [[NSUserDefaults alloc] initWithSuiteName: @"FDHC2KMZ6V.com.jwwalker.autopairs.suite"]. What's puzzling me is that if I go to Terminal and enter defaults read FDHC2KMZ6V.com.jwwalker.autopairs.suite it tells me that the domain does not exist. Is this a bug in the defaults tool, or is there some trick I'm missing?
4
1
1.2k
May ’24
Help interpreting crash report, is KVO involved?
I'm getting occasional crashes, which have not happened while running under a debugger and I haven't figured out how to reproduce. I wonder if anyone can help me glean more information from a crash report. Here's the main part. This particular report if from macOS 14.2 beta, but I've also seen it from 14.1.1. Exception Type: EXC_BAD_ACCESS (SIGSEGV) Exception Codes: KERN_INVALID_ADDRESS at 0x0000000000000018 Exception Codes: 0x0000000000000001, 0x0000000000000018 VM Region Info: 0x18 is not in any region. Bytes before following region: 140723250839528 REGION TYPE START - END [ VSIZE] PRT/MAX SHRMOD REGION DETAIL UNUSED SPACE AT START ---> mapped file 7ffcaf60c000-7ffcd7f48000 [649.2M] r-x/r-x SM=COW ...t_id=b7394f27 Error Formulating Crash Report: PC register does not match crashing frame (0x0 vs 0x1022A3630) Thread 0 Crashed:: Dispatch queue: com.apple.main-thread 0 <translation info unavailable> 0x1022a3630 ??? 1 libsystem_platform.dylib 0x7ff819d0b393 _sigtramp + 51 2 AppKit 0x7ff81d3549a6 -[NSControl _setWindow:] + 59 3 AppKit 0x7ff81d413c19 -[NSSegmentedControl _setWindow:] + 42 4 AppKit 0x7ff81defd3be __21-[NSView _setWindow:]_block_invoke.391 + 324 5 AppKit 0x7ff81d33a62c -[NSView _setWindow:] + 1886 6 AppKit 0x7ff81defd3be __21-[NSView _setWindow:]_block_invoke.391 + 324 7 AppKit 0x7ff81d33a62c -[NSView _setWindow:] + 1886 8 AppKit 0x7ff81d572d08 -[NSWindow dealloc] + 922 9 MyApp 0x1011b6b81 -[JWWindow dealloc] (in MyApp) (JWWindow.m:37) 10 Foundation 0x7ff81b3d179c _NSKVOPerformWithDeallocatingObservable + 151 11 Foundation 0x7ff81acc6d54 NSKVODeallocate + 150 12 libobjc.A.dylib 0x7ff8199189d7 AutoreleasePoolPage::releaseUntil(objc_object**) + 169 13 libobjc.A.dylib 0x7ff819915cf0 objc_autoreleasePoolPop + 235 14 CoreFoundation 0x7ff819d794a1 _CFAutoreleasePoolPop + 22 15 Foundation 0x7ff81ac869ea -[NSAutoreleasePool drain] + 133 16 AppKit 0x7ff81d315694 -[NSApplication run] + 653 17 AppKit 0x7ff81d2e9662 NSApplicationMain + 816 18 MyApp 0x100ef5034 start (in MyApp) + 52 I can see that it involves deallocating a window as part of draining an autorelease pool, but does the presence of _NSKVOPerformWithDeallocatingObservable mean that KVO is involved somehow? And does the note "PC register does not match crashing frame" tell me anything?
10
0
8.2k
Jun ’24
install_name_tool vs. codesign
I have a shell script that turns a framework into a plain dylib and updates some dependent library paths using install_name_tool. It works, but if the framework was signed, I get warnings like: install_name_tool: warning: changes being made to the file will invalidate the code signature in: [redacted].dylib (for architecture x86_64) I thought I could get rid of the warning by adding codesign --remove-signature dylib-path to the script before using install_name_tool, but then I get errors like install_name_tool: fatal error: file not in an order that can be processed (link edit information does not fill the __LINKEDIT segment): [redacted].dylib (for architecture x86_64) Is there a way to fix this?
1
0
1.9k
Mar ’24
Xcode won't symbolicate .ips crash log
I was my understanding that you're supposed to be able to open a .ips crash log in Xcode and see pretty much what you would see if the app had been running in the debugger when it crashed. But the addresses in my app don't get symbolicated. I opened the .ips in the same project and same version of Xcode that was used to create the app. The .dSym file is around, and I can use it to symbolicate using the atos tool. What am I missing?
3
1
2.4k
Feb ’25
How to print WKWebView in Sequoia?
I want to print the content of a WKWebView. I've done some searching, and many people have struggled with this over the years. Some claimed success, but their solutions don't work for me. One person created images for each pages and printed that, but then if you were to print to PDF, you'd get a PDF containing images rather than text. If I just call the printView(_:)) method of the view, I get blank pages. With the following more elaborate code, I get a partial printout, 11 out of what should be about 13 pages. let info = NSPrintInfo.shared info.topMargin = 72.0; info.bottomMargin = 72.0; info.leftMargin = 72.0; info.rightMargin = 72.0; info.isVerticallyCentered = false; info.isHorizontallyCentered = false; info.horizontalPagination = .fit; info.verticalPagination = .automatic; let printOp = webView!.printOperation( with: info ) printOp.canSpawnSeparateThread = true printOp.view?.frame = NSMakeRect( 0, 0, info.paperSize.width, info.paperSize.height ) printOp.runModal(for: webView.window!, delegate: self, didRun: nil, contextInfo: nil ) When I run the above under the debugger, I see console messages saying CGContextClipToRect: invalid context 0x0. Once the print dialog appears, if I touch (but not change) the selected printer, then the page count changes to the correct value.
13
0
219
Oct ’25