Saving Data from iphone app to text file in iPhone app <p>I want to save my application data in text file in documents folder I am using following way to store but it store single string i want that my data is in array how may store all the contents of array in text files</p> <pre><code> NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES); NSString *documentsDirectory = [paths objectAtIndex:0]; NSString*yourString=@"This is working fine"; NSString *filePath = [documentsDirectory stringByAppendingPathComponent:@"file.txt"]; NSString *stringWithoutSpaces = [yourString stringByReplacingOccurrencesOfString:@" " withString:@""]; [stringWithoutSpaces writeToFile:filePath atomically:TRUE encoding:NSUTF8StringEncoding error:NULL]; </code></pre> <p>My Array is like Following</p> <pre><code> DataController *coffeeObj = [appDelegate.coffeeArray objectAtIndex:indexPath.row]; cell.resturantLocationLabel.text=coffeeObj.resturantLocation; cell.foodQualityRatingLabel.text=coffeeObj.foodQualityRating; cell.foodPresentationRatingLabel.text=coffeeObj.foodPresentationRating; cell.waiterRatingLabel.text=coffeeObj.waiterRating; cell.ambienceRatingLabel.text=coffeeObj.ambienceRating; cell.overallRatingLabel.text=coffeeObj.overallRating; cell.commentsLabel.text=coffeeObj.comments; cell.emailAddressLabel.text=coffeeObj.emailAddress; cell.addtoMailingListLabel.text=coffeeObj.addtoMailingList; NSString*test=coffeeObj.comments; </code></pre>