I'm calling a method on a key event which updates a label.
[self updateFolderText];
When I do this in the event method it works, but when I try to do this in the ViewDidLoad() I get a compiler error.
- (void)viewDidLoad
{
[super viewDidLoad];
[self updateFolderText];
}
I get the following error:
error: Automatic Reference Counting Issue: Receiver type 'ViewController'
for instance message does not declare a method with selector 'updateFolderText'
Ehm... I guess this must be trivial... I'm new to objective-c. Thanks. :)
The issue is probably because your method updateFolderText
is defined below viewDidLoad
. Move your code for updateFolderText
below, and it should work.
Or, you can declare the method explicitly in your class. Add the following above @implementation
.
@interface className()
-(void)yourMethod; //not sure how youve fully define updateFolderText
@end
or, as you say, you can also define it in your header file:
-(void)yourMethod; //not sure how youve fully define updateFolderText