Skip to content

Instantly share code, notes, and snippets.

@pita5
Created January 10, 2012 15:07
Show Gist options
  • Save pita5/1589508 to your computer and use it in GitHub Desktop.
Save pita5/1589508 to your computer and use it in GitHub Desktop.
NSMutableData *data = [NSMutableData data];
NSKeyedArchiver *archiver = [[[NSKeyedArchiver alloc] initForWritingWithMutableData:data] autorelease];
[archiver setOutputFormat:kCFPropertyListXMLFormat_v1_0];
[archiver encodeObject:self.attributedString];
// Sanity check
NSMutableDictionary *dict = [NSPropertyListSerialization propertyListFromData:data
mutabilityOption:NSPropertyListMutableContainersAndLeaves
format:nil
errorDescription:nil];
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment