- (void)getData:(void(^)(id result))completionBlock {
NSURLRequest *request = [NSURLRequest requestWithURL:[NSURL URLWithString:@""]];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *task = [session dataTaskWithRequest:request completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error.description);
} else {
NSError *parsingError;
NSDictionary *parsedData = [NSJSONSerialization JSONObjectWithData:data options:NSJSONReadingAllowFragments error:&parsingError];
if (parsingError) {
NSLog(@"Error while parsing data %@", parsingError.description);
} else {
dispatch_async(dispatch_get_main_queue(), ^{
if (completionBlock){
completionBlock(parsedData);
}
});
}
}
}];
[task resume];
}
[self getData:^(id result){
//process
}];
- (void)tableView:(UITableView *)tableView accessoryButtonTappedForRowWithIndexPath:(NSIndexPath *)indexPath{}
[self performSegueWithIdentifier:@"SEGUE_ID" sender:self]; //*
@property (strong, nonatomic) NSObject *a;
@property (weak, nonatomic) NSObject *b;
NSObject *_a = [NSObject new]; // retainCount == 1
self.a = _a; //retainCount == 2
_a = nil; // объект ещё не удалён , retainCount == 1
self.a = nil; // объект будет удален
NSObject *_b = [NSObject new]; // retainCount == 1
self.b = _b; // retainCount == 1
_b = nil; // объект будет удален, а в self.b будет nil