<分区>
<分区>
如何在 iphone 中使用“JSON”解析器解析存储在资源文件夹中的文本文件“.txt”? 任何建议将不胜感激。 谢谢内哈·梅塔。
最佳答案
加载文本文件..并初始化 JSON..简单。
NSString *textPAth = [[NSBundle mainBundle] pathForResource:@"content" ofType:@"txt"];
NSError *error;
NSString *content = [NSString stringWithContentsOfFile:textPAth encoding:NSUTF8StringEncoding error:&error]; //error checking omitted
SBJsonParser *parser = [[SBJsonParser alloc] init];
NSDictionary *json = [parser objectWithString: content];
关于iphone - 在iphone中使用json解析文本文件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9562192/
相关文章:
iphone - 无法在 ios 9 中为 AVCaptureDevice 访问相机。
ios - 如何更改 UITextView 中 UIDataDetector 检测到的链接的颜色?
iphone - 当我连接设备 iOS 4.2.1 时,每次在 Xcode Organizer 中都会收到 "Unknown iOS Detected"
iphone - 当应用程序转到后台时如何创建 "return to app"状态栏?
python - 使用 python 处理从 semrush 到 JSON 的 CSV 响应
javascript - 当 json 具有相同名称的键时,new Map() 在 javascript 中如何工作
json - 使用 ARM 模板和 JSON 在 Azure 中创建 VM 时出现 "DiskImageNotReady"错误