NSCopyObject, an ancient Foundation function, has become more complex over time. Originally resembling memcpy, it now involves object_copy and object_setClass due to ARC metadata introduced in Mac OS X 10.6. NSCopyObject can cause issues with subclassing and copying objects, especially with incomplete metadata for non-ARC-managed ivars. Apple has officially deprecated NSCopyObject since 2012, warning against its use due to potential errors and lack of support for certain ivars. Despite this, Apple still employs NSCopyObject in their frameworks like AppKit. Subclassing classes like NSCell can lead to challenges with NSCopyObject, necessitating manual retention in Swift and Objective-C to avoid memory leaks or crashes.
https://wadetregaskis.com/nscopyobject-the-griefer-that-keeps-on-griefing/