iphone - writeToFile not saving new entry into plist

后端 未结 2 1750
梦谈多话
梦谈多话 2020-12-12 02:18

My writeToFile is not saving my data to my .plist.

- (IBAction)clickBtnDone:(id) sender {
 NSLog(@\"Done\");
 if ([txtGroupName.text length] > 0) {  
  [s         


        
2条回答
  •  一生所求
    2020-12-12 02:58

    How you have initialized groupPath? It should be the path of document directory, not the path of resource directory.

    You should do something similar :

    NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
    NSString *documentsDirectory = [paths objectAtIndex:0];
    NSString *filePath = [documentsDirectory stringByAppendingPathComponent:FILE_NAME];
    

    You can not edit the file that is present in the workspace.

提交回复
热议问题