Reputation: 1255
My app requires the ability to take a String
and save it to an NSDictionary
as an NSData
object, such that when the NSDictionary
is written to a .plist
file the resulting file contains the data as <data>The String as the user typed it (no encoding)</data>
. Is there anyway to do that without manually writing the XML for the .plist
file?
Thanks in advance for any help.
Upvotes: 0
Views: 289
Reputation: 90571
There's no way to do what you want.
First, it makes no sense to claim that you don't want the string encoded. Encoding is the process of producing a byte stream from a string. Without encoding, there's no representation of the string. Strings are abstract. They have no concrete representation in and of themselves. Only encoding produces that.
Anyway, that's just not how NSData
objects are serialized to property list files. Even if you manually wrote the file, it wouldn't really be a correct property list file and no other property-list-reading program would be able to parse it. How did you come to conclude that your app requires this ability?
Upvotes: 3