I'm a cocoa and Objective-c newbie.
I'm trying to build a mac app, and when I try to create a new controller which inherits from NSViewController, it automatically gives me a - (void)viewDidLoad
in the .m file (but not in the .h). The problem is that the compiler always yells saying "No visible @interface for 'NSViewContoller' declares the selector 'viewDidLoad'.
How is this possible? Please help me understand what is happening here and how I can fix it. Thank you.
ViewDidLoad is only supported in NSViewController if you target OSX Yosemite and upwards ! Remove it if you are targeting below Yosemite for your app and use -awakeFromNib
or -loadView
method instead.
As you can see it in Apple's NSViewController Reference that it is
Available in OS X v10.10 and later.
P.S This happened to me while developing an app for OSX Mevericks and above when I inherited a class from NSViewController and Xcode 6 automatically generated ViewDidLoad method for me which is actually a bug (I Think)