Post

Replies

Boosts

Views

Activity

Measuring Mac Metal FPS
When running a macOS app rendering with Metal under the Xcode 12 debugger, the debug navigator displays FPS (frame rate) among other things. But if I launch the program outside Xcode and attach to the process, the debug navigator does not show FPS, though it does show memory usage and such. What's up with that? I tried changing the Run mode of the scheme to use the Release build instead of the the Debug build, but then rendering was quite noticeably slower. Is there some quick way to get a frame rate? I'm aware that Instruments can measure various things relating to Metal, but it's not obvious to me how to see something as simple as a frame rate.
0
0
1k
Mar ’21
Xcode build rule input files
As I understand it, when you define a custom build rule with a script, Xcode will pass each matching input file to your script though variables like INPUT_FILE_PATH. So you normally don't need to explicitly list input files. However, there is an "input files" section in the build rule definition. How is that used? I'm hoping that it only used for dependencies and deciding whether a rule needs to be run. For example, suppose my rule is compiling a source file. Normally I just want to re-run the compile if the source file changes, but if the compiler itself changes, I probably also want to recompile. Can I list the compiler as an input file?
0
0
1k
Jun ’21
SSL error on download, Sierra only
I have an app that uses NSURLDownload to download some files. I get an SSL error when running on Sierra (macOS 10.12), but it works fine on El Capitan (10.11) and High Sierra (10.13) and later. Safari has no problem downloading the same file on Sierra. Logging the NSError from the download:didFailWithError: delegate method shows: Error Domain=NSURLErrorDomain Code=-1200 "An SSL error has occurred and a secure connection to the server cannot be made." UserInfo={NSURLErrorFailingURLPeerTrustErrorKey=<SecTrustRef: 0x7f9620045950>, NSLocalizedRecoverySuggestion=Would you like to connect to the server anyway?, _kCFStreamErrorDomainKey=3, _kCFStreamErrorCodeKey=-9802, NSErrorPeerCertificateChainKey=(     "<cert(0x7f961f14ce00) s: files.frameforge.com i: R3>",     "<cert(0x7f961f12bc00) s: R3 i: ISRG Root X1>",     "<cert(0x7f961f12c400) s: ISRG Root X1 i: DST Root CA X3>" ), NSUnderlyingError=0x7f961e4af1a0 {Error Domain=kCFErrorDomainCFNetwork Code=-1200 "An SSL error has occurred and a secure connection to the server cannot be made." UserInfo={NSErrorFailingURLStringKey=https://files.frameforge.com/webgrab/mac/ff4.0-mac-update-list.xml.wgz, NSLocalizedRecoverySuggestion=Would you like to connect to the server anyway?, _kCFNetworkCFStreamSSLErrorOriginalValue=-9802, kCFStreamPropertySSLPeerCertificates=(     "<cert(0x7f961f14ce00) s: files.frameforge.com i: R3>",     "<cert(0x7f961f12bc00) s: R3 i: ISRG Root X1>",     "<cert(0x7f961f12c400) s: ISRG Root X1 i: DST Root CA X3>" ), _kCFStreamPropertySSLClientCertificateState=0, kCFStreamPropertySSLPeerTrust=<SecTrustRef: 0x7f9620045950>, NSLocalizedDescription=An SSL error has occurred and a secure connection to the server cannot be made., _kCFStreamErrorDomainKey=3, NSErrorFailingURLKey=https://files.frameforge.com/webgrab/mac/ff4.0-mac-update-list.xml.wgz, _kCFStreamErrorCodeKey=-9802}}, NSLocalizedDescription=An SSL error has occurred and a secure connection to the server cannot be made., NSErrorFailingURLKey=https://files.frameforge.com/webgrab/mac/ff4.0-mac-update-list.xml.wgz, NSErrorFailingURLStringKey=https://files.frameforge.com/webgrab/mac/ff4.0-mac-update-list.xml.wgz, NSErrorClientCertificateStateKey=0} Any idea how I could fix this? Regarding the recovery suggestion "Would you like to connect to the server anyway?", how would I do that, use an http URL?
2
0
1.3k
Jul ’21
Xcode live issues bogus errors
I have a project with several targets, which use different header paths and have some C++ code conditionalized by preprocessor symbols with #if. The targets build without error, but "live issues" produces errors, because apparently it's using the wrong headers but the right preprocessor symbols. I've tried nuking the derived data. Any other suggestions? I'm using Xcode 13.2.
1
0
561
Dec ’21
Can one create an NSBitmapImageRep from floating-point data?
In the documentation of -[NSBitmapImageRep initWithBitmapDataPlanes:pixelsWide:pixelsHigh:bitsPerSample:samplesPerPixel:hasAlpha:isPlanar:colorSpaceName:bitmapFormat:bytesPerRow:bitsPerPixel:], it says that the bitmap format mask can include NSBitmapFormatFloatingPointSamples, which suggests that the answer is yes, but it also says that the number of bits per component can be at most 16, which suggests that the answer is no.
1
0
1.2k
Apr ’22
Any way to make block from CFRunLoopPerformBlock run?
I have some NSViews that come and go during printing, and I want them to dealloc soon rather than waiting until the whole printing process is finished. The problem is that inside -[NSView addSubview:], the subview gets retained several times, and one of those schedules a release using CFRunLoopPerformBlock. But I don't have a run loop running, so that's not happening. The documentation of CFRunLoopPerformBlock says If you want the work performed right away, you must explicitly wake up that thread using the CFRunLoopWakeUp function. But calling CFRunLoopWakeUp( CFRunLoopGetMain() ) does not help, probably because the run loop is not running. If I call -[NSApplication nextEventMatchingMask: ...] in one of the standard modes, then the block from CFRunLoopPerformBlock runs, but too much other stuff also runs, such as queued notifications.
1
0
968
Oct ’22
How is CGRequestPostEventAccess supposed to work?
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?
3
0
1.2k
Dec ’22
NSApplicationActivateAllWindows does not work, any alternative?
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?
2
0
893
Jan ’23