有人可以向我解释为什么这段代码不起作用吗?我将数组的元素发送到 NSLog 没有问题,但它们似乎没有附加到字符串中。我必须将数组元素转换为字符串吗?
success:^(NSURLRequest *request, NSHTTPURLResponse *response, id JSON) {
NSArray *dataarray=[JSON valueForKey:@"Data"];
NSLog(@"Response: %@", [JSON valueForKeyPath:@"Status"]);
NSString* output = [NSString stringWithFormat:@"response: %@",[JSON valueForKeyPath:@"Status"]];
int x;
for (x=0; x<[dataarray count]; x++) {
NSLog(@"%d : %@",x, [dataarray objectAtIndex:x]);
[output stringByAppendingFormat:@" %@ ",[dataarray objectAtIndex:x]];
}
//NSLog(@"%@", JSON);
NSLog(@"%@", output);
self.outPut2.text=output; }