0

This is my code:

NSString *plistDataPath = [[NSBundle mainBundle] pathForResource:@"CustomServices" ofType:@"plist"];
NSMutableArray *CustomServicesArray = [[NSMutableArray alloc] initWithObjects:
                                       textboxValues[0],textboxValues[1],textboxValues[2],textboxValues[3],
                                       textboxValues[4],textboxValues[5],textboxValues[6],textboxValues[7],
                                       textboxValues[8],textboxValues[9],textboxValues[10],textboxValues[11],
                                       textboxValues[12],textboxValues[13],textboxValues[14],textboxValues[15],
                                       textboxValues[16],textboxValues[17],textboxValues[18],textboxValues[19],
                                       textboxValues[20],textboxValues[21],textboxValues[22],textboxValues[23],
                                       nil];

if(![CustomServicesArray writeToFile:plistDataPath atomically:NO]) {
    NSLog(@"Array wasn't saved properly");
};

The CustomServicesArray has valid data in it, and there was no error returned from the writeToFile. I have looked at the file, which has yesterday's creation date, but it is empty; apparently it is not overwriting the file today. Am I supposed to delete the specific plist file first?

SpokaneDude
  • 4,856
  • 13
  • 64
  • 120
  • I can't tell you why `writeToFile:` does not return an error, but on the iOS device you definitely cannot write to a file in the application bundle because that is read-only. – Martin R Aug 20 '13 at 18:49
  • RATS! and I knew that... thank you... can you make your comment into an answer please? – SpokaneDude Aug 20 '13 at 18:59
  • 1
    Well, I am glad that you solved it, but I am reluctant to write an answer because there must be already *many* duplicate questions with answers. – Martin R Aug 20 '13 at 19:06
  • OK... well thank you anyway... have spent about 1 hour on this, getting nowhere! :D – SpokaneDude Aug 20 '13 at 19:55

0 Answers0