문제

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