سؤال

This may be me being incredibly thick, but how do I store a BOOL in a UIDocument? I am currently using NSFileWrappers for storing a string and an image in the "contentsForType:error:" method, but seeing as there's no way to convert a bool into NSData, what would be the best way?

Thanks

هل كانت مفيدة؟

المحلول

You can get a NSData object from a BOOL:

NSData* data=[NSKeyedArchiver archivedDataWithRootObject: [NSNumber numberWithBool: YES]];
مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top