iphone - How do I save an NSString as a .txt file on my apps local documents directory? -


How can I save an NSString as a .txt file on my apps Local Document Directory (UTF-8)?

  NSArray * path = NSSearchPathForDirectoriesInDomains (NSDocumentDirectory, NSUserDomainMask, YES); NSString * document directory = [path item overindexx: 0]; // Get the directory of the document NSError * error; BOOL succeed = [myString writeToFile: [document directory stringbapping path comparison: @ "myfile.txt"] Atomically: Yes Encoding: NSUTF8 string encoding error: & amp; Error]; If (! Successful) {// handle error here}  

Comments

Popular posts from this blog

sql - dynamically varied number of conditions in the 'where' statement using LINQ -

asp.net mvc - Dynamically Generated Ajax.BeginForm -

Debug on symbian -