I am trying to save data in the documents folder on iPhone 5.1 simulator.
NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDo
Swap out your [NSString stringWithFormat:] for an [NSString stringByAppendingPathComponent:]. This makes or breaks your ability to create a viable path, or so my experience has taught me.
Additionally, this sort of thing comes up when writing on the simulator vs a real device. The simulator is a lot more forgiving when you are saving things in the wrong paths than the device will be, and quite often you'll get the I/O working fine only to run into the notorious 'It works in the simulator!' pit. stringWithFormat: is just one way to fall in.