{"response":[33689822,64091979,69682048,74160161]}

--
- (void)requestCompleted:(ASIHTTPRequest *)request
{
    NSString *responseString = [request responseString];
    NSLog(@"okRequest|| %@",responseString);

    SBJSON *parser = [[SBJSON alloc] init];

    // Prepare URL request to download statuses from Twitter

    // Get JSON as a NSString from NSData response
    NSString *json_string = [[NSString alloc] initWithString:responseString];

    // parse the JSON response into an object
    // Here we're using NSArray since we're parsing an array of JSON status objects
    NSArray *statuses = [parser objectWithString:json_string error:nil];

    // Each element in statuses is a single status
    // represented as a NSDictionary
    for (NSDictionary *status in statuses)
    {
        //all other func..
        NSLog(@"%@ ", status);///This func prints only "response"
    }
}

如何在“响应”中获取数字数组? (33689822,64091979,69682048,74160161)

最佳答案

尝试这个:

for (NSNumber *number in [statuses objectForKey:@"response"]) {
    NSLog(@"%@", number);
}

关于ios - JSON iOS解析字符串,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/6055049/

10-10 02:12