1

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

Community
  • 1
  • 1
vesselhead
  • 331
  • 4
  • 13
  • What is the class in .xib -> File's Owner -> Show the identity Inspector -> Custom class -> Class? – Nekto Sep 06 '11 at 19:42
  • From Inspector the Class is myViewController – vesselhead Sep 06 '11 at 19:57
  • I believe if the file owner had been wrong, the app wouldn't run as expected. That is the interesting thing. Everything runs as it should. But the error always shows up in the debugger. – vesselhead Sep 06 '11 at 19:58

1 Answers1

0

You might take a look at my solution in this thread, I double checked that all of my classes have a corresponding @implementation specified in their .m files.

Community
  • 1
  • 1
Zack Morris
  • 4,727
  • 2
  • 55
  • 83