1

I realize this error has been discussed many times on stackoverflow, but I'm still not sure what I'm missing. Here's the console output:

Unknown class CRBarGraphController in Interface Builder file.
2014-11-18 18:40:05.796 Test[7319:60b] -[UIImageView start2]: unrecognized selector sent to instance 0x16562ac0
2014-11-18 18:40:06.256 Test[7319:60b] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[UIImageView start2]: unrecognized selector sent to instance 0x16562ac0'

CRBarGraphController.m defines a function (void)start2; also declared in the interface for CRBarGraphController.h.

start2 is called from CRGraphViewController.m using the following code:

-(void)viewWillAppear:(BOOL)animated {
    self.navigationController.navigationBarHidden = NO;
    [self.bar_Graph start2];
}

where, bar_Graph is an object of CRBarGraphController, declared in CRGraphViewController.h as:

@property (weak, nonatomic) IBOutlet CRBarGraphController *bar_Graph;

CRGraphViewController.h does import CRBarGraphController.h Also, in the storyboard, bar_Graph outlet is set to class, CRBarGraphController.

Why does XCode still think bar_Graph is an instance of UIImageView and not CRBarGraphComtroller? I included an exception breakpoint to make sure the exception originates from where start2 is being called.

novalagung
  • 10,905
  • 4
  • 58
  • 82
  • Did you declare the start2 method in both the .h and .m files? – Joao Nov 19 '14 at 03:18
  • Yes, I declared it in the interfaces of both CRBarGraphController.h and CRBarGraphController.m. – Aniket Deshpande Nov 19 '14 at 03:40
  • By looking into the XML project definition file, is the object defined as a CRBarGraphController? If so, could you try cleaning the project and rebuilding it again? Sometimes XCode gets messed up. – Joao Nov 19 '14 at 04:03
  • I did a clean (command+shift+k) & rebuild as well as a clean build folder (command+option+shift+k) & rebuild, and got the same result. I'm not sure where to find the XML project definition file. Could you please explain? – Aniket Deshpande Nov 19 '14 at 08:01

0 Answers0