Post

Replies

Boosts

Views

Activity

What does CAMetalLayerWantsCompositingDependencies in Info.plist do?
I've noticed a major third-party app has the following flag set to 1/true in its Info.plist: CAMetalLayerWantsCompositingDependencies Does anyone know if it’s recognized by Core Animation / Metal, and what it’s supposed to do? It might obviously have zero relationship to the OS, defined by that app and for that app... but since it looks very much like an unofficial/undocumented environment setting, it might be great to know what problem it solves. I happen to have issues related to compositing other CALayers over a CAMetalLayer in my app... so this definitely stood out as interesting. Thank you!
0
0
157
2w
Source code to NSStringFromSelector() available anywhere?
Does anyone know if any Apple Open Source repository would contain the source code to NSStringFromSelector? TSAN has pointed out an issue in my code that stems from assuming that the value returned by NSStringFromSelector is immutable, and that the function itself is re-entrant. I’d like to check both those assumptions against the actual sources... assuming they haven't changed in macOS Sequoia to begin with.
1
0
370
Aug ’24
Does objc_setAssociatedObject() work reliably when used with "bridgeable" Core Foundation types?
I'm investigating an odd problem that surfaced with macOS Sequoia related to CoreGraphics (CGColorSpaceCreateWithICCData()). I couldn't find a reliable way to track the lifetime (retain/releases) of a CGColorSpaceRef (any pointers appreciated) so I was hoping to use objc_setAssociatedObject() to attach an instance of my own class that would be deallocated when the "owning" CGColorSpaceRef is deallocated. In this way I could set a breakpoint on my own code, presumably invoked when the CGColorSpaceRef is itself going away. While objc_setAssociatedObject() does seem to work, the results don't seem deterministic. Is it because objc_setAssociatedObject() simply won't work reliably with CF types?
6
0
613
Aug ’24
Xcode 16 crashes when attempting to view Build Settings for a target with Build Carbon Resources phase
This is both a heads up and an invitation for anyone affected by this to file feedback. All betas of Xcode 16, up to beta 4, will crash when you attempt to view the Build Settings for any target that happens to have a Build Carbon Resources phase. Any lucky soul who is still dealing with Rez, please make sure to file feedback to try and have this issue solved.
2
0
433
Jul ’24
How to prevent TSAN from reporting data-races that are intentional and considered safe?
I'm having a hard time relying on TSAN to detect problems due to its rightful insistence on reporting data-races (I know, stick with me). Picture the following implementation of a lazily-allocated property in an Obj-C class: @interface MyClass { id _myLazyValue; // starts as nil as all other Obj-C ivars } @end @implementation MyClass - (id)myLazyValue { if (_myLazyValue == nil) { @synchronized(self) { if (_myLazyValue == nil) { _myLazyValue = <expensive computation> } } } return _myLazyValue; } @end The first line in the method is reading a pointer-sized chunk of memory outside of the protection provided by the @synchronized(...) statement. That same value may be written by a different thread within the execution of the @synchronized block. This is what TSAN complains about, but I need it not to. The code above ensures the ivar is written by at most one thread. The read is unguarded, but it is impossible for any thread to read a non-nil value back that is invalid, uninitialized or unretained. Why go through this trouble? Such a lazily-allocated property usually locks on @synchronized once, until (at most) one thread does any work. Other threads may be temporarily waiting on the same lock but again only while the value is being initialized. The cost of allocation and initialization is guaranteed to be paid once: multiple threads cannot initialize the value multiple times (that’s the reason for the second _myLazyValue == nil check within the scope of the @synchronized block). Subsequent accesses of the initialized property skip locking altogether, which is exactly the performance we want from a lazily-allocated, immutable property that still guarantees thread-safe access. Assuming there isn't a big embarrassing hole in my logic, is there a way to decorate specific portions of our sources (akin to #pragma statements that disable certain warnings) so that you can mark any read/write access to a specific value as "safe"? Is the most granular tool for this purpose the __attribute__((no_sanitize("thread")))? Ideally one would want to ask TSAN to ignore only specific read/writes, rather than the entire body of a function. Thank you!
8
0
1.3k
Nov ’23
Xcode 15: Build Carbon Resources phase deprecation, solution renders project incompatible with Xcode 14
Xcode 15 warns you when targets contain a Build Carbon Resources phase. The solution is to drag all your .r files to the Copy Bundle Resources phase instead, and deleting the now-empty Build Carbon Resources phase. Beware that after this change your project is unlikely to build correctly with Xcode 14. While both versions of Xcode support .r files in the Copy Bundle Resources phase, invoking Rez to compile your inputs, Xcode 14 incorrectly outputs a .rsrc file whose name matches the input .r file (MyResources.r → MyResources.rsrc). This is wrong, since the Carbon Resource Manager recognizes only one file containing Carbon resources (AFAIK) and its name must match the bundle executable. If your executable is named Foo, your Carbon resources should be in a Foo.rsrc file or else they will be ignored. It is unclear if Xcode 15 is smart enough to merge the output of multiple .r files into a single .rsrc. Lucky me I don't need that functionality for my targets but it's something else to look out for. ...and for those in utter disbelief that in 2023 there are still people talking about and using Carbon Resources as designed and implemented in the 80s... welcome to the world of third-party plug-ins for Adobe apps ;-)
0
0
735
Jun ’23
Xcode 15: "Cycle inside ...; building could produce unreliable results" due to DSTROOT=/
Offering this here for those who may run into the same issue... There is more than one reason you may get the following error message when attempting to build your targets: Cycle inside ...; building could produce unreliable results But if you just switched to Xcode 15 and you are currently customizing DSTROOT to set the root install location for the deliverables (app, bundle, etc) built by your Target, Xcode 15 will refuse to build any target with dependencies on other targets that use the same underlying configuration. There is obviously no real cycle: Xcode 15 is just confused by both targets sharing the same DSTROOT. For example, if you set up your projects with: DSTROOT=/ INSTALL_PATH=/Applications (notice that DSTROOT=/ is even mentioned in the docs) Xcode will wrongfully detect a circular dependency as both targets share the build destination and thus refuse to build. The solution is to not customize DSTROOT, thus allowing it to have a directory name that is target-dependent and thus fairly immune to collisions. Instead, customize the INSTALL_ROOT setting. While this setting does not appear in the Build Phases tab, it defaults to reusing the DSTROOT value. If you set it explicitly, it allows DSTROOT to remain for other purposes, while using the value of INSTALL_ROOT to deploy your deliverables: INSTALL_ROOT=/ INSTALL_PATH=/Applications This allows the build system to proceed without errors.
29
16
36k
Jun ’23
Does Xcode 13.2 no longer create default.metallib for Framework targets, automatically?
Is anyone else seeing that Xcode 13.2 no longer creates a single default.metallib that combines all *.air files together? (Seeing this with a framework target, at least.) Nothing in the release notes suggests this change... so for now a custom script like the following seems needed: if [ ! -d "${METAL_LIBRARY_OUTPUT_DIR}"/default.metallib ]; then      xcrun -sdk macosx metallib "${TARGET_TEMP_DIR}"/Metal/*.air -o "${METAL_LIBRARY_OUTPUT_DIR}"/default.metallib fi; Would be grateful to know if this is a bug or an intended change in the toolchain. Thanks!
2
0
1.4k
Dec ’21
Xcode 13 Building Woes
The Xcode 13 Beta (1 & 2) is showing some serious performance regressions when building our large project, and wondering if others are noticing the same. If you Build again after a build had just completed, Xcode 13 redoes a ton of work, as visible through the thousands of tasks it takes on. It's as if Xcode 13 lost the ability to skip unnecessary work. Building again in Xcode 12 does incur a small penalty too, but the difference is between 2-3 seconds (Xcode 12) vs 1-2 minutes (Xcode 13). ...and as a side note, the new progress reporter is useless: it switches from reporting progress for one set of tasks (1928/3022 completed) to a completely different set of tasks (444/1255 completed). You never know which "set of tasks" is the last you'll need for the build process as a whole to be done. Any idea why it doesn't display cumulative progress? Thanks!
2
0
1.5k
Jun ’21
Why does Safari 14 Beta on macOS Big Sur Beta open custom URLs in its own Sandbox Container?
We have a non-sandboxed app that uses a custom URL scheme to allow redirection of certain tasks from Safari to our app, when installed, and with permission from the user. In the latest Beta of Safari 14 on macOS Big Sur Beta, Safari launches our app in its own Sandbox Container. This obviously breaks our software, which expects and requires a "normal" environment. This is a regression in Safari. It still asks for permission before opening every single custom URL. Users still have to install our notarized software beforehand on their systems in order to access these custom URLs. I tried filing a bug. Tried a DTS ticket. No reply to either. Does anyone know of this problem, and know of a workaround? Our software obviously cannot escape Safari’s sandbox container. At best we can detect it, right now, but our software is broken 😫 For the record, if the user launches our app *before* attempting to open the custom URL, then Safari is more than happy to pass along the URL to the running instance of our software (which is great). But if Safari has to launch our app in order to process the custom URL, our app lives within the confines of Safari’s container.
3
0
1.2k
Sep ’20
Location of framework binaries under SIP?
When looking under /System/Library/Frameworks, it is apparent that while the framework structure is all there, its binary is not. I presume this is due to SIP hiding binaries from the file system. Is there any magic incantation to access those binaries for non-nefarious purposes (e.g. class-dump)? If one gets the NSBundle for one of the classes in AddressBook.framework, for example, its executable path is still reported as: /System/Library/Frameworks/AddressBook.framework/Versions/A/AddressBook ...even though the file isn't part of the file system and thus cannot be accessed. Is there a way to get to the object code without having to disable SIP or otherwise cripple one’s system? Thank you!
1
0
2.2k
Sep ’20
altool error -"There is no embedded Java executable. Please reinstall the Xcode developer tools."
Is notarization via altool under Xcode 12 Beta 2 and macOS Big Sur Beta supposed to work yet? Altool still works when using the Xcode 11.x tools, but if I switch the command line tools to Xcode 12, any attempt to submit software for notarization via xcrun altool returns error -19,060: "There is no embedded Java executable. Please reinstall the Xcode developer tools." Thanks!
1
0
838
Jul ’20