I'm trying to return a NSMutableArray
from my block in my method, but when I add the line return [responseString JSONValue];
, I get some compiler warnings.
- (NSMutableArray*)getTodayData:(NSDate*)today
{
ASIFormDataRequest *request = [[[ASIFormDataRequest alloc] initWithURL:url] autorelease];
[request setPostValue:[dateFormat stringFromDate:today] forKey:@"target_date"];
NSError *error = [request error];
[request setCompletionBlock:^{
NSString *responseString;
if (!error) {
responseString = [request responseString];
return [responseString JSONValue];
} else {
NSLog(@"error: %@", error);
}
}];
[request setFailedBlock:^{
NSString *responseString;
if (!error) {
responseString = [request responseString];
} else {
NSLog(@"error: %@", error);
}
}];
[request startAsynchronous];
}
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…