问题
Quite unexpectedly after doing some minor modifications, my code has started crashing with:
-[CLLocation length]: unrecognized selector sent to instance 0x1b3739c0.
This happens after the app has completed the display of the cells of a table, more precisely after exiting:
- (void)tableView:(UITableView *)tableView willDisplayCell:(UITableViewCell *)cell forRowAtIndexPath:(NSIndexPath *)indexPath
I tried putting breakpoints in all length accesses in the code, but none of them was caught. I also set a breakpoint on [NSObject(NSObject) doesNotRecognizeSelector:] and this in fact was caught, but gave no information altogether. I also investigated the crash log but the last contact of the crashing thread with my app was in the main function. How may I discover the point of the program producing the crash?
回答1:
CLLocation
does not have a length method, see docs. If it's not your code (you seemed to imply that), maybe it's something in one of your dependencies?
Btw, you should add an exception breakpoint, it should catch that.
回答2:
In fact one the table textfields was incorrectly a CLLocation. The only catch was the timing of the error. Thank you everyone.
来源:https://stackoverflow.com/questions/29701734/cllocation-length-unrecognized-selector-after-table-display