谁能告诉我为什么我不能在那里返回 NSMutableArray:
-(NSMutableArray)makeServiceRequest:(UIViewController *)sender
{
NSMutableString *urlString= [NSString stringWithFormat:@"http://www.servicedata/%@", _searchValue];
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
NSData* data = [NSData dataWithContentsOfURL:
[NSURL URLWithString: urlString]];
NSError* error;
NSMutableArray *json = [NSJSONSerialization JSONObjectWithData:data
options:kNilOptions
error:&error];
dispatch_async(dispatch_get_main_queue(), ^(){
NSLog(@"json arrived");
return json;
});
});
}
我已经在头文件中很好地声明了它。有没有办法把它变成一个类方法?