I wanted to name my nib differently from my .h and .m files. I think of the view as just that, a view. So I don't see why 'Controller' should be in the name which seems to be the convention. When I do this and make sure that the delegates, views, etc. are set correctly, I get the following runtime warning when I load myView.xib; however, everything runs as expected. I don't like to leave warnings lingering. How do I get rid of it?
Unknown class myView in Interface Builder file
myView.xib
<object class="NSMutableArray" key="dict.values">
<bool key="EncodedWithXMLCoder">YES</bool>
<string>myViewController</string>
<string>UIResponder</string>
<string>myView</string>
myViewController.h/m
@interface myViewController
I have looked through all of the related threads on this error and none of the answers or scenarios 100% match.
Reference: Unknown class MyOldClass in Interface Builder file -- in my case, the grep would show that I do have a reference to myView. If I rename this to myViewController I get the following:
-[myViewController _setViewDelegate:]: unrecognized selector sent to instance 0x186550
*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[myViewController _setViewDelegate:]: unrecognized selector sent to instance 0x186550'
Reference: "Unknown class <MyClass> in Interface Builder file" error at runtime
I played with ideas on this thread and it did not work. -all_load -ObjC flags don't resolve the error. Nor does the KeepAlive hack.
However, I don't think this is a link error. The class myView exists in context of the nib. So this would be a runtime dynamic loading issue. Also, myView does exist. It is the view in the nib.
Should I just conceded and make my nib file have the same filename as .m and .h files? Any thoughts?
tx