I create my Custom Container View Controller according to Apple’s guide, which means I use no segue. To send data from my ChildVC to my ParentVC I use the following schema.
In ChildVC.h
typedef void (^ActionBlock)(NSUInteger);
@property (nonatomic, copy) ActionBlock passIndexToParent;
Then in ParentVC.m viewDidLoad
childVC.passIndexToParent=^(NSUInteger imageIndex){
//do some cool stuff
}
ChildVC contains a TableView and the button(s) to be clicked is in a cell in the table so I use the following technique to get the index of the row clicked
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
    //…
     //target action
    [cell.myImageButton addTarget:self action:@selector(getIndexOfTapped:) forControlEvents:UIControlEventTouchUpInside];
    //…
    return cell;
}
- (void) getIndexOfTapped:(id)sender
{
    NSLog(@“X image tap confirmed");
    CGPoint buttonPosition = [sender convertPoint:CGPointZero toView:self.tableView];
    NSIndexPath *indexPath = [self.tableView indexPathForRowAtPoint:buttonPosition];
    if (indexPath != nil)
    {
        NSLog(@"INDEX of X image tapped is %ld",(long)indexPath.row);
        self.passIndexToParent(indexPath.row);//Thread 1: EXC_BAD_ACCESS(code=1, address=0X10)
    }
}
Now when I run the program I get
Thread 1: EXC_BAD_ACCESS(code=1, address=0X10)
for line
self.passIndexToParent(indexPath.row);
No further error data. Any help fixing this problem?
 
     
    