Json-Frameworkを使用して、Webサイトからの出力(iPhone上)を解析しようとしています。Webサイトのデータは、PHPのjson_encode()を介して渡されるニュースオブジェクトの配列です。
JSON出力はここにあります:http://pastebin.com/Be429nHx
サーバーに接続してJSONデータを保存できるので、次のようにします。
NSString *jsonString = [[NSString alloc] initWithData:data encoding:NSUTF8StringEncoding];
// Create a dictionary from the JSON string
NSDictionary *results = [jsonString JSONValue];
NSArray *items = [results valueForKeyPath:@"data.array"];
NSLog(@" NewsID : %@", [[items objectAtIndex:1] objectForKey:@"newsID"]);
NSLog()行から次のエラーが表示されます。
-JSONValue failed. Error is: Didn't find full object before EOF
Event Id : (null)
STATE: <SBJsonStreamParserStateStart: 0x4e3c960>
JSONValue failed. Error is: Token 'key-value separator' not expected before outer-most array or object
Event Id : (null)
どんな助けでも大歓迎です...ありがとう!!!