Your code is working at my end, i have just tested it. Where are you checking your changes? Use Documents directory path. To get path -
NSLog(@"%@",documentsDirectory);
and copy path from console and then open finder and press Cmd+shift+g and paste path here and then open your file