iOS 8: -[UITableViewWrapperView textField]: unrecognized selector sent to instance

rebello95

Hello: I've been testing my app on iOS 6, 7, and now 8 (beta 5). My UITableView with custom UITableViewCells is working fine on 6 and 7. However, on iOS 8, I'm getting a crash when I attempt to access a subview (text field) of a cell.

I am aware of the fact that there's another view in the cell's hierarchy in iOS 7. Strangely, it appears that this isn't the case in iOS 8. Here's the code I'm using:

    //Get the cell
    CustomCell *cell = nil;

    //NOTE: GradingTableViewCell > UITableViewCellScrollView (iOS 7+ ONLY) > UITableViewCellContentView > UIButton (sender)
    if (floor(NSFoundationVersionNumber) <= NSFoundationVersionNumber_iOS_6_1) {
        cell = (CustomCell *)sender.superview.superview;
    } else {
        cell = (CustomCell *)sender.superview.superview.superview;
    }

    //Get the cell's index path
    NSIndexPath *indexPath = [self.tableView indexPathForCell:cell];

    //etc.

    NSLog(@"%@", cell.textField); //<---Crashes here

So, as you can see, I'm accounting for the extra view in iOS 7. After adding some breakpoints and taking a closer look at the variables, I see that cell exists, but all the subviews it has in the interface file (which are linked up) - including textField - are nil. At the line specified, I'm receiving the following crash log:

-[UITableViewWrapperView textField]: unrecognized selector sent to instance 0x12c651430

I looked into this further, and I found this:

Changing the else statement to be identical to the preceding line gets rid of the crash, and the app works fine (using sender.superview.superview like in iOS 6).

This makes no sense to me. Did Apple revert the hierarchy of UITableViewCells to that of iOS 6's, or am I missing something? Thanks!

geraldWilliam

I've encountered the same issue. Here's a more reliable method:

UITextField* textField = (UITextField*)sender;
NSIndexPath* indexPath = [self.tableView indexPathForRowAtPoint:[self.tableView convertPoint:textField.center fromView:textField.superview]];

This will work regardless of the underlying view hierarchy of UITableViewCell.

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

Google Play Game Services iOS: [UITableViewWrapperView style]: unrecognized selector sent to instance

From Dev

Google Play Game Services iOS: [UITableViewWrapperView style]: unrecognized selector sent to instance

From Dev

iOS, unrecognized selector sent to instance?

From Dev

indexPathForCell unrecognized selector sent to instance on iOS 8 with ObjC

From Dev

FBSDK for iOS: "unrecognized selector sent to instance"

From Dev

iOS unrecognized selector sent to instance in Swift

From Dev

ios - copyWithZone:]: unrecognized selector sent to instance

From Dev

iOS - keyboardWillShow: unrecognized selector sent to instance

From Dev

ios 7 unrecognized selector sent to instance

From Dev

FBSDK for iOS: "unrecognized selector sent to instance"

From Dev

Unrecognized selector sent to instance on ios tutorial

From Dev

unrecognized selector sent to instance

From Dev

Unrecognized selector sent to an instance?

From Dev

unrecognized selector sent to instance

From Dev

unrecognized selector sent to instance

From Dev

UITapGestureRecognizer unrecognized selector sent to instance

From Dev

Unrecognized selector sent to instance - Swift

From Dev

CollectionViewCell unrecognized selector sent to instance

From Dev

unrecognized selector sent to instance @dynamic

From Dev

Swift: unrecognized selector sent to instance

From Dev

UICollectionViewCell unrecognized selector sent to instance

From Dev

UICollectionView: Unrecognized selector sent to instance

From Dev

"unrecognized selector sent to instance" at performSegueWithIdentifier

From Dev

Unrecognized selector sent to instance for setDetailModal

From Dev

xcode - unrecognized selector sent to instance

From Dev

Unrecognized selector sent to instance on segue

From Dev

unrecognized selector sent to instance for button

From Dev

Unrecognized selector sent to instance with Swift

From Dev

UISwipeGesture 'unrecognized selector sent to instance'

Related Related

  1. 1

    Google Play Game Services iOS: [UITableViewWrapperView style]: unrecognized selector sent to instance

  2. 2

    Google Play Game Services iOS: [UITableViewWrapperView style]: unrecognized selector sent to instance

  3. 3

    iOS, unrecognized selector sent to instance?

  4. 4

    indexPathForCell unrecognized selector sent to instance on iOS 8 with ObjC

  5. 5

    FBSDK for iOS: "unrecognized selector sent to instance"

  6. 6

    iOS unrecognized selector sent to instance in Swift

  7. 7

    ios - copyWithZone:]: unrecognized selector sent to instance

  8. 8

    iOS - keyboardWillShow: unrecognized selector sent to instance

  9. 9

    ios 7 unrecognized selector sent to instance

  10. 10

    FBSDK for iOS: "unrecognized selector sent to instance"

  11. 11

    Unrecognized selector sent to instance on ios tutorial

  12. 12

    unrecognized selector sent to instance

  13. 13

    Unrecognized selector sent to an instance?

  14. 14

    unrecognized selector sent to instance

  15. 15

    unrecognized selector sent to instance

  16. 16

    UITapGestureRecognizer unrecognized selector sent to instance

  17. 17

    Unrecognized selector sent to instance - Swift

  18. 18

    CollectionViewCell unrecognized selector sent to instance

  19. 19

    unrecognized selector sent to instance @dynamic

  20. 20

    Swift: unrecognized selector sent to instance

  21. 21

    UICollectionViewCell unrecognized selector sent to instance

  22. 22

    UICollectionView: Unrecognized selector sent to instance

  23. 23

    "unrecognized selector sent to instance" at performSegueWithIdentifier

  24. 24

    Unrecognized selector sent to instance for setDetailModal

  25. 25

    xcode - unrecognized selector sent to instance

  26. 26

    Unrecognized selector sent to instance on segue

  27. 27

    unrecognized selector sent to instance for button

  28. 28

    Unrecognized selector sent to instance with Swift

  29. 29

    UISwipeGesture 'unrecognized selector sent to instance'

HotTag

Archive