Post

Replies

Boosts

Views

Activity

Reply to “Unrecognized selector sent to instance” when calling UIButton.addTarget in a class
I found this topic because I had a very similar problem. The problem in my code was two identical method names. Once called with the button action: @IBAction func save() {..} then in the file AppDelegate in the method saveContext in a do {} catch command: func saveContext() { ... try context.save() ... } I renamed the button action, redo the connection and the code is now executing properly.
Nov ’23