Objective C: JSON to JSON Object
Taking up iOS again from the start. And now recalling why I quit last
time. Anyway, here's my problem. Please help me figure out the issue.
Please don't point to other links on SO. I've almost literally gone
through all PHP-JSON-Objective C questions on here. Also, NO FRAMEWORKS
please.
Here's the php:
header('content-Type: application/json; charset=utf-8');
echo json_encode($result);
Here's the output:
<html>
<body>
{"loginstatus":"0"}
</body>
</html>
Here's the objective-c code:
NSDictionary *parsedJSON = [NSJSONSerialization
JSONObjectWithData:oResponseData options:kNilOptions error:&errorInfo];
if (parsedJSON == nil) {
NSLog(@"not created");
NSLog(@"Error: %@", [errorInfo userInfo]);
}
Here's the output:
2013-08-11 16:08:38.734 TestProject [32516:c07] not created
2013-08-11 16:08:38.736 TestProject [32516:c07] Error: {
NSDebugDescription = "JSON text did not start with array or object and
option to allow fragments not set.";}
No comments:
Post a Comment