I have a custom UITableViewCell
subclass and I'm trying to add a pinch gesture recognizer using Interface Builder to one of the views. My app crashes with:
2016-09-11 17:37:22.425 MYAPPNAME[4619:1284144] *** Assertion failure in -[ULFeedView _dequeueReusableViewOfType:withIdentifier:], /BuildRoot/Library/Caches/com.apple.xbs/Sources/UIKit/UIKit-3512.60.12/UITableView.m:6539
I've tried different gesture recognizers (e.g. tap recognizers) and different subviews, but they all crash my app.
An interesting observation: It doesn't crash if I add the recognizer to a view programmatically at awakeFromNib
.
Here is some methods that might be relevant:
-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{
[tableView deselectRowAtIndexPath:indexPath animated:YES];
if(indexPath.section != SECTION_CONTENT){
return; //index path section is NOT equal to SECTION CONTENT for the cell in question, so it will always return.
}
...
}
-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
switch (indexPath.section) {
case SECTION_MAP:
{
ULMapCell *cell = [tableView dequeueReusableCellWithIdentifier:@"map" forIndexPath:indexPath];
return cell; //the cell in question is this one, so it will always return this cell.
}
...
}
UPDATE: I have no problems with registering nibs. It was already working perfectly before the gesture recognizer. Please stop telling me how to register nibs for table view, I already know that as a senior iOS developer.
UPDATE 2: I confirm that it is occuring only when I add it through Interface Builder and there is no problem if I add it anywhere programmatically.
Why would this be happening?