問題があり、何が起こっているのかわかりません。1 時間前に動作していたが、動作を停止しました。理由がわかりません。:s
この JSON をローカルホストのフォルダーに追加して、このコードを試していただけますか。次に、NSLOGがこれよりも優れたものを出力するかどうか教えてください:
2012-05-16 11:18:21.996 WonderBox[51241:fb03] JSON : (null)
NSString *urlString = [NSString stringWithFormat:@"http://localhost:8888/WonderBox/json.txt"];
NSData *data = [NSData dataWithContentsOfURL:[NSURL URLWithString:urlString]];
NSError *err;
NSMutableArray *json = (NSMutableArray* )[NSJSONSerialization JSONObjectWithData:data options:kNilOptions error:&err];
NSLog(@"JSON : %@", json);
私のJSON:
{
"boxesDetail": [
{
"name": "NAME1",
"number": "12",
"sexe": "female",
"topic": "Bien-être",
},
{
"name": "NAME2",
"number": "33",
"sexe": "couple",
"topic": "Bien-être",
},
{
"name": "NAME3",
"number": "43",
"sexe": "female",
"topic": "Gastronomie",
},
{
"name": "NAM E4",
"number": "33",
"sexe": "couple",
"topic": "Adventure",
},
{
"name": "NAME5",
"number": "102",
"sexe": "group",
"topic": "Gastronomie",
},
{
"name": "NAME6",
"number": "40",
"sexe": "male",
"topic": "Sport",
},
{
"name": "NAME7",
"number": "12",
"sexe": "male",
"topic": "Sport",
}
]
}