Write JSON Response to .plist File

前端 未结 6 1603
遥遥无期
遥遥无期 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 11:50

    NSArray *paths = NSSearchPathForDirectoriesInDomains(NSLibraryDirectory, NSUserDomainMask, YES);
    NSString *libraryPath = [paths objectAtIndex:0];
    NSString *filename = @"FinalResult.plist";
    NSString *pathFilename = [libraryPath stringByAppendingPathComponent:filename];
    
    NSDictionary *dictResult = [json objectForKey:@"myKey"];
    [dictResult writeToFile:pathFilename atomically:YES];
    

提交回复
热议问题