Monday, 19 August 2013

Adopting NSSecureCoding with opaque types

Adopting NSSecureCoding with opaque types

I have an Objective-C class that needs to adopt NSSecureCoding for
transport across an XPC connection. The class has a couple properties that
are opaque types (dispatch_queue_t and dispatch_group_t).
How would I go about implementing -initWithCoder: and -encodeWithCoder: in
this case? The documentation says that these are object-like structures so
I'm assuming they would need to be converted to/from raw bytes when
encoding/decoding? If this is the case, I'm not sure which methods should
be used to do this. Another option would be to simply avoid encoding them
at all and recreate them inside -initWithCoder:.

No comments:

Post a Comment