Write JSON Response to .plist File

前端 未结 6 1638
遥遥无期
遥遥无期 2021-02-20 11:14

Frustration on the Top !!!

I am getting some JSON Response from the Service and I want to store it in the .plist file

6条回答
  •  情话喂你
    2021-02-20 12:16

    Try this, it will work :

    NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
    NSString *documentsDirectory = [paths objectAtIndex:0];
    NSString *path = [documentsDirectory stringByAppendingPathComponent:@"country.plist"];
    [jsonData writeToFile:path atomically:YES];
    

提交回复
热议问题