Under ARC, is it possible to encode/decode a CGMutablePathRef (or its non-mutable form) using NSCoding? Naively I try:
path = CGPathCreateMutable();
...
[aCoder encodeObject:path]
but I get a friendly error from the compiler:
Automatic Reference Counting Issue: Implicit conversion of an Objective-C pointer to 'CGMutablePathRef' (aka 'struct CGPath *') is disallowed with ARC
What can I do to encode this?
NSCodingis a protocol. Its methods can only be used with objects that conform to theNSCodingprotocol. aCGPathRefisn’t even an object, soNSCodingmethods won’t work directly. That’s why you’re getting that error.Here’s a guy who has come up with a way to serialize CGPaths.