2737

Objective-c property reinitialization

Question:

I am creating this question to make my last question to be more specific, here is my last question: <a href="https://stackoverflow.com/questions/24937453/ioscs193p-fall2013-assignment2-task2add-a-button-to-let-user-to-restart-the-ga" rel="nofollow">IOS:CS193p fall2013 assignment2 task2:add a button to let user to restart the game</a>

This is the specific error message I got: 2014-07-26 10:31:55.110 Matchismo[525:60b] -[CardGameViewController redealButton:]: unrecognized selector sent to instance 0x8c27590 2014-07-26 10:31:55.247 Matchismo[525:60b] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[CardGameViewController redealButton:]: unrecognized selector sent to instance 0x8c27590'

Here is the code I wrote in the button touching method, trying to "clear" the original object(memory) which is referenced by my two properties(game, theDeck), and reassign them with brand new objects in order to restart the game.

- (IBAction)touchReadealButton:(UIButton *)sender { self.theDeck = [[PlayingCardDeck alloc] init]; self.game = [[CardMatchingGame alloc]initWithCount:[self.cardButtons count] usingDeck:self.theDeck]; }

Answer1:

My guess is that your button is hooked up to a IBAction method that does not exist anymore. Check the xib/storyboard where your CardGameViewController exists and check what the button is connected to. I'm guessing you renamed the method from redealButton: to touchReadealButton: at some point

Recommend

  • help with openmp compilation problems
  • update date value in oracle
  • compare two NSDate fails
  • how do you “Press ENTER to continue, anything else to quit” in C++
  • Can't add target for UIButton - unrecognised selector sent to instance, despite method been in
  • C++, user input check for '\\0' stops at spaces?
  • K Shortest Path Python Not Working
  • JsonConverter: Get parent object in ReadJson, without $refs
  • unrecognized selector isPitched called
  • How to set an entity field that does not exist on the table but does exists in the raw SQL as an ali
  • MRO with multiple inheritance in python
  • how to ignore xml namespaces?
  • Is there any way to call saveCurrentTurnWithMatchData without sending a push notification?
  • Outlook to Excel hyperlink issue
  • Efficient User-Agent Regex to find Safari in Python
  • Get Currently Active User in Android
  • C# - Most efficient way to iterate through multiple arrays/list
  • What is the correct way to synchronize a shared, static object in Java?
  • Two Tables Serving as one Model in Rails
  • Consuming a WCF service in a Java Client using wsHttpBinding
  • as3-flash: any way to access all the instances placed in different frames from document class?
  • how does System.Web.HttpRequest::PathInfo work?
  • Element.tagName for python not working
  • Spring Cloud Microservice Architecture Confusion
  • gspread or such: help me get cell coordinates (not value)
  • How can I set a binding to a Combox in a UserControl?
  • SplFileObject error failed to open stream: No such file or directory
  • print() is showing quotation marks in results
  • Play WS (2.2.1): post/put large request
  • Refering to the class itself from within a class mehod in Objective C
  • Exception “firebase.functions() takes … no argument …” when specifying a region for a Cloud Function
  • Highlight one bar in a series in highcharts?
  • req.body is undefined - nodejs
  • Symfony2: How to get request parameter
  • Akka Routing: Reply's send to router ends up as dead letters
  • Calling of Constructors in a Java
  • Is there a mandatory requirement to switch app.yaml?
  • SetUp method failed while running tests from teamcity
  • PHP: When would you need the self:: keyword?
  • What are the advantages and disadvantages of reading an entire file into a single String as opposed