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
updateFolderTextis defined belowviewDidLoad. Move your code forupdateFolderTextbelow, and it should work.Or, you can declare the method explicitly in your class. Add the following above
@implementation.or, as you say, you can also define it in your header file: