我已经从服务器获取了数据并且传递的数据也填充了NSMutableArray
after NSJSONSerialization
.
数组输出如下:
NSArray *jsonArray = (NSArray *)json;
NSLog(@"Array - %@",jsonArray);
我想创建一个新数组,其中包含时事通讯的所有数据。
Array - (
{
error = 0;
newsletter = (
{
date = "2015-11-23";
description = "Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry\\'s standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop p";
id = 42;
image = "link/uploads/14482883361619729430.png";
"post_count" = 1;
"posted_by" = admin;
title = Testing;
},
{
date = "2015-11-23";
description = "Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry\\'s standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop p";
id = 43;
image = "link/uploads/14483023241983843096.png";
"post_count" = 0;
"posted_by" = admin;
title = "Lorem Ipsum";
},
我尝试过使用该功能objectAtIndex
但没用,我正在检查计数jsonArray
.
NSLog(@"count of array - %lu",jsonArray);
它显示 2 作为计数器。
我的代码:
if (responseData != nil) {
NSMutableArray *json = [NSJSONSerialization JSONObjectWithData:responseData //1
options:NSJSONReadingMutableContainers
error:&err];
NSArray *jsonArray = (NSArray *)json;
NSLog(@"Array - %@",jsonArray);
NSLog(@"Count %lu",[jsonArray count]);
}
问题更新:
我想填充两个数组 1 将有error = 0;
第二个应该需要在新闻通讯中包含所有数据
= (
{
date = "2015-11-23";
description = "Lorem Ipsum is simply...";
id = 42;
image = "link/uploads/14482883361619729430.png";
"post_count" = 1;
"posted_by" = admin;
title = Testing;
}
希望现在问题有点清楚了......
预先感谢您理解这个问题。