在iphone中使用Brautaset Json框架时出错

jak*_*kob 5 iphone json http

我正在尝试发出http请求.代码如下所示:

NSString *urlString = [NSString stringWithString:@"http://www.foo.se/bartojson.php?venue=47497"]; 


NSLog(@"retain %d urlString %@", [urlString retainCount], urlString );
    NSURL *url = [NSURL URLWithString:urlString];
    [urlString release];

    NSString *jsonString = [NSString stringWithContentsOfURL:url];
    NSDictionary *httpResult = [jsonString JSONValue];
Run Code Online (Sandbox Code Playgroud)

在浏览器中调用页面时,结果如下所示:

{"name":"test","description":"这是一个测试." ,"评论":[{"等级":"5","描述":"不错"},{"等级":"3","描述":"非常好!"}}}

但是从代码中调用它时我得到了这个:

Error Domain = org.brautaset.JSON.ErrorDomain Code = 3 UserInfo = 0x582640"密钥期望的对象值:评论"

对于指向新词典的评论似乎存在一些问题.你能帮我理解这个错误信息吗?

jak*_*kob 6

好吧,我找到了错误的原因.结果中的愚蠢窗口换行使JSONValue调用失败.删除所有\ r \和中提琴一切都像魅力!