I want to have a GUID in my objective-c model to act as a unique identifier. My problem is how to save CFUUIDRef with my NSCoder since it is not an object type.
I continue to play with the following lines for encoding / decoding, but I cannot find good examples of how to save structure types in objective-c (all my NSObject types are perfectly encoded / decoded).
eg. for coding I'm trying (which, I think, looks good?):
CFUUIDBytes bytes = CFUUIDGetUUIDBytes(uuid);
eencoder encodeBytes: &bytes length: sizeof(bytes)];
and for decoding, where I get stuck more:
NSUInteger blockSize;
const void* bytes = [decoder decodeBytesForKey: kFieldCreatedKey returnedLength:&blockSize];
if(blockSize > 0) {
uuid = CFUUIDCreateFromUUIDBytes(NULL, (CFUUIDBytes)bytes);
}
I gt "convert to non-scalable type" error above - I tried several implementations of the bits of code that I saw on the Internet. Can someone point me in the right direction? Tim