There's not a general solution for all opaque types, but you mentioned dispatch_queue_t
and dispatch_group_t
. If the dispatch queue and group are private to the coded object, then just recreate them in -initWithCoder:
like Kurt Revis said. If they're shared, it is a little bit more hairy, but you can sometimes work around it by archiving a "surrogate" object, then traversing your object graph after decoding it, replacing all references to the surrogate with references to a single, newly-created "real" object.
Really though, this sounds suspiciously like an anti-pattern. Classes that implement NSCoding/NSSecureCoding would typically be model classes, and it's kind of a red flag that there are dispatch queues and groups in ivars of a model class. I can think of some legitimate reasons to have a private queue (i.e. serializing multithreaded access to internal state) in a model class ivar, but not a shared one. In general, it sounds like some re-factoring might be in order.