我将如何测试从 JSON Web 服务下载数据需要多长时间
目前我是以下代码,并想 NSLog 下载需要多长时间。
- (void)downloadData{
// Download the JSON
NSString *jsonString = [NSString
stringWithContentsOfURL:[NSURL URLWithString:queryLine]
encoding:NSStringEncodingConversionAllowLossy|NSUTF8StringEncoding
error:nil];
NSMutableArray *itemsTMP = [[NSMutableArray alloc] init];
// Create parser for the api
SBJSON *parser = [[SBJSON alloc] init];
NSDictionary *results = [parser objectWithString:jsonString error:nil];
itemsTMP = [results objectForKey:@"results"];
[self setAllItems:[itemsTMP copy]];
self.displayItems = [itemsTMP copy];
int a = [displayItems count];
NSString *countString = [NSString stringWithFormat:@" results %d",a];
countLabel.text = countString;
}
谢谢你的帮助