App crashing when calling function

Discussion in 'iOS Programming' started by emachine990, Sep 23, 2010.

  1. emachine990 macrumors newbie

    Joined:
    Sep 20, 2010
    #1
    I have an NSObject set up to control various elements on my screen.

    I initialize the class inside my View Controller like this:
    Code:
    self.pageSetupClass = [[PageSetup alloc] set:self.pageID];
    In IB I have added my NSObject object and linked a button to an IBOutlet on it. I've also linked it to an IBAction found in the object. When I click this button the app crashes and I get this error:

    Code:
    2010-09-23 15:33:11.640 BookTest10[49139:207] *** -[NSCFDictionary clickSoundByte:]: unrecognized selector sent to instance 0x4b10bc0
    2010-09-23 15:33:11.641 BookTest10[49139:207] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '*** -[NSCFDictionary clickSoundByte:]: unrecognized selector sent to instance 0x4b10bc0'
    2010-09-23 15:33:11.642 BookTest10[49139:207] Stack: (
        42195024,
        43352876,
        42203739,
        41666166,
        41662962,
        2915566,
        3413054,
        3422400,
        3417197,
        3042792,
        2934339,
        2965976,
        51188092,
        41474204,
        41470120,
        51181725,
        51181922,
        2958194
    )
    terminate called after throwing an instance of 'NSException'
    There is nothing in the function at the moment so it must be the calling that crashes it...right?

    If you need me to post more code I certainly can. If you have any ideas I'm all ears. Thank You
     
  2. admanimal macrumors 68040

    Joined:
    Apr 22, 2005
    #2
    As the error message says, somewhere in your code you are trying to send a clickSoundByte message to an NSDictionary, which of course it doesn't recognize. Do you have that message call somewhere in your code?
     
  3. emachine990 thread starter macrumors newbie

    Joined:
    Sep 20, 2010
    #3
    In my view controller header I'm setting up the class

    Code:
    PageSetup *pageSetupClass;
    and

    Code:
    @property (nonatomic, retain)	PageSetup	*pageSetupClass;
    Then in my implementation file I'm reinitializing and reseting it with a new variable.

    Code:
    self.pageSetupClass = [[PageSetup alloc] init];
    	[self.pageSetupClass set:self.pageID];
    Could it be that I"m breaking the connection with the button on screen when I do that?

    My plan was to reinitialize the PageSetup object and have it reset the buttons on the screen depending on the situation. Perhaps I shouldn't be using the object to move them but just to store where they should be. Then have the Viewcontroller take those values and move everything. Make sense? Does it sound like my assessment is somewhat legit?
     
  4. Sykte macrumors regular

    Joined:
    Aug 26, 2010
    #4

    You will need to post additional code. As the previous poster pointed out you are passing clickSoundByte: to an object of NSCFDictionary. I would suggest debugging your app to find the exact location of the error.
     

Share This Page