Breaking on Unrecognized Selector

unrecognized selector sent to instance

In Xcode (3), enable:

Run > Stop on Objective-C Exceptions

run your program in Debug.

Ultimately what is happening is an (objc) object is requested to perform a message which it does not respond to (i.e. is not implemented).

Typically, this happens as a programmer's mistake (at least, for me), such as an argument passed as another type, which slips through a cast, id, or objc_object container (e.g. any collection class - NSArray, NSSet, NSDictionary).

Sometimes this happens if you forget to implement the instance method.

Sometimes this happens if you are testing against an earlier release of the software, which did not implement the instance method (i.e. it was added in a following release).

unrecognized selector sent to instance error in Objective-C

It looks like you're not memory managing the view controller properly and it is being deallocated at some point - which causes the numberButtonClicked: method to be sent to another object that is now occupying the memory that the view controller was previously occupying...

Make sure you're properly retaining/releasing your view controller.

How can I fix the error unrecognized selector sent to instance...?

The tutorial you are following is quite old and is based on iOS 6.
Since iOS 8 the NSObject protocol (which is inherited by all objects based on NSObject) has defined the description property as a read-only string. Properties cannot be overridden in a subclass, so your attempt to create a read/write description property won't work.

You should use some other property name, such as itemDescription rather than description.

Unrecognized selector sent to instance _UIAlertControllerAlertPresentationController

I think the problem is that you are not using the completion handlers correctly, therefore at the same time there is one alert appearing and disappearing. For example, instead of:

    informativeAlert.dismissViewControllerAnimated(true, completion: nil)
completion?()

You should use

    informativeAlert.dismissViewControllerAnimated(true, completion: completion)

Also, the implementation of isTopViewController can fail easily if a view controller animation is in process.

For example, if you call showErrorView twice, isTopViewController will be probably true for both calls and two alerts will start appearing at once, crashing your app.

unrecognized selector sent to instance

I guess that you are incorrectly linking them.

you need to add UITableViewDelegate to your super Class

and in the viewDidLoad

self.tableView.delegate = self
self.tableView.dataSource = self

make sure you are linking the tableView as follows

IMG1. IMG2

you should have this!

You should end up with this

Unrecognized selector sent to instance 0x7fecc7011000 In Swift

The problem is this outlet:

IBOutlet weak var tableView: UITableView!

You have hooked it up in the storyboard to the wrong object. It is hooked to the cell, not the table view. It looks like you must have hooked it up and then changed the class of the thing it is hooked to.

unrecognized selector sent to instance when i call from another class

What you need to do is to select target accordingly

     var orderViewCard = OrderVC()

let tapGestureRecognizer = UITapGestureRecognizer(target: orderViewCard, action: #selector(orderViewCard.handleCardTap))
orderViewCard.handleArea.addGestureRecognizer(tapGestureRecognizer)


Related Topics



Leave a reply



Submit