objective c - Is there a method for adding one NSString for NSData? -


i'm working on writing file 1 user input on textfield. far have 1 nsfilemanager writes data file. still, have no way of putting textfield input inside file.

is there way add string value nsdata can write it?

you can nsdata nsstring,

nsdata *newdata = [yourstring datausingencoding:nsutf16stringencoding]; 

use encoding fits case. append obtained data existing nsdata,

[existingdata appenddata:newdata] 

note: "existingdata" should instance of nsmutabledata.


Comments