I have problem with this block. I trying to get the data inside the block of NSURLSession
.
here's my code
-(NSDictionary *) RetrieveData{
NSURLSession * session = [NSURLSession sharedSession];
NSURL * url = [NSURL URLWithString: self.getURL];
dataList =[[NSDictionary alloc] init];
NSURLSessionDataTask * dataTask = [session dataTaskWithURL:url completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
self.json = [NSJSONSerialization JSONObjectWithData:data options:0 error:nil];
}];
return self.dataList;
[dataTask resume];
}
Is it possible to get the data inside the blocks of NSURLSession
?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…