Reputation: 29925
Is there any way I can store and retrieve multiple text strings in an NSData
object?
I am looking into external accessories and just wondering how multiple arbitrary parameters are transmitted to and from the devices.
I assume that they will need to be decoded into NSString
objects from an NSData
object. So is there any way to distinguish between separate NSString
objects from one stream of data?
Or, will multiple string parameters be stored in separate NSData
objects? With a buffer for each?
Thanks
Upvotes: 0
Views: 306
Reputation: 14302
Use the NSKeyedArchiver to to archive an array of NSStrings.
+ (NSData *)archivedDataWithRootObject:(id)rootObject
Upvotes: 1