[英]ios how to save json data call as file
Any of you knows how can I save a json data call into a file? 你们谁都知道如何将json数据调用保存到文件中?
self.results=[NSJSONSerialization
JSONObjectWithData:jsonData
options:0
error:&error];
I tried: 我试过了:
[_results writeToFile:@"jsonFile" atomically:YES];
But I don't see the file: 但我看不到该文件:
NSArray * directoryContents = [[NSFileManager defaultManager] contentsOfDirectoryAtPath:directory error:&error]; NSArray * directoryContents = [[[NSFileManager defaultManager] contentsOfDirectoryAtPath:directory error:&error];
file path (
"Default-568h@2x.png",
"Default.png",
"Default@2x.png",
"en.lproj",
"Info.plist",
"JSON Generator",
PkgInfo
)
Any of you knows what I'm doing wrong? 你们当中有人知道我在做什么错吗?
I'll really appreciate your help 非常感谢您的帮助
JSONObjectWithData
returns either an NSArray
, NSDictionary
or nil. JSONObjectWithData
返回NSArray
, NSDictionary
或nil。 If not nil write it with: 如果不是nil,则写为:
- (BOOL)writeToFile:(NSString *)path atomically:(BOOL)flag
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.