11 Nov 2010, 10:40
Generic-user-small

Dr Ian Hocking (5 posts)

Hi there

I’m just starting out with Cocoa programming - love the book thus far. I’m new to Xcode but have programmed heavily in C about ten years ago.

I’m having a niggling issue, however. When I try to compile the ‘Text.app’ project after the addition of the first NotifyingClass instance, I get the following message in the log:

bq. 2010-11-10 21:10:50.868 TextApp[7940:a0f] Unknown class ‘NotifyingClass’, using ‘NSObject’ instead. Encountered in Interface Builder file at path /Users/ianuser/Documents/Programming/Beginning Mac Programming/Chapter 2 Your First Application/TextApp/build/Debug/TextApp.app/Contents/Resources/English.lproj/MainMenu.nib.

I’ve downloaded the sample code from the website and it runs fine. I’ve compared this project to my own closely, and both seem identical. But I’m still getting the above error! I could just use the sample code and proceed to the next chapter but I’d really like to figure out what’s causing this. Any ideas?

I’m running Xcode 1.2.4 (64 bit), IDE 1708.0, Core 1705.0, ToolSupport 1591.0

Best wishes

Ian

11 Nov 2010, 11:08
Generic-user-small

Tim Isted (105 posts)

Hi Ian,

Are the two files @NotifyingClass.h@ and @NotifyingClass.m@ definitely in the project’s Groups & Files list, and both saved? And is the @NotifyingClass@ classname spelled the same in both the header file and the Interface Builder xib file?

If you right-click (or Ctrl-click) on the @RootViewController.m@ file in the Groups & Files list and choose Get Info, then click the Targets tab, is there are tick in the checkbox next to TextApp? If not, tick the box. It’s possible that this got unticked somehow (it also appears in the main project window in some panel configurations), which would mean that although the file is kept organized by the project, it’s not compiled for or included in the final TextApp executable.

Finally, can you try Cleaning your project before Building it again? Choose Build > Clean (Shift-Cmd-K), then Build as normal.

Please let me know how you get on, Thanks, Tim

11 Nov 2010, 18:16
Generic-user-small

Dr Ian Hocking (5 posts)

Hi Tim

Thanks for the quick reply - and the great book.

bq. Are the two files NotifyingClass.h and NotifyingClass.m definitely in the project’s Groups & Files list, and both saved?

Check.

bq. And is the NotifyingClass classname spelled the same in both the header file and the Interface Builder xib file?

Check.

bq. If you right-click (or Ctrl-click) on the RootViewController.m file…

Hmm, I don’t seem to have one of these.

bq. Finally, can you try Cleaning your project before Building it again? Choose Build > Clean (Shift-Cmd-K), then Build as normal.

Tried that, and I had the same error.

The plot thickens!

Best Ian

11 Nov 2010, 18:55
Generic-user-small

Tim Isted (105 posts)

Bah - I’m an idiot - not the @RootViewController.m@ file, the @NotifyingClass.m@ file. I was checking the menu options on an iOS project I happened to have open, and wrote down the file name without thinking. Apologies.

If that doesn’t work, then perhaps you could send me your project and I’ll take a look. My email address is most easily found via my own website…

Sorry you’ve run into this - it’s not a typical error to have at this point! Tim

14 Nov 2010, 11:57
Generic-user-small

Dr Ian Hocking (5 posts)

Hi Tim

I’ve just had a look for the check box in the NotifyingClass.m file and it is checked. Curious! I’m going to email the project to you. All very strange - maybe it corrupted in some way. I think I’ll work through the first exercise again, just for practice, and see if the same issue comes up.

Best wishes and thanks for looking into this, Ian

14 Nov 2010, 12:28
Generic-user-small

Dr Ian Hocking (5 posts)

Hi Tim

I’ve just worked through the tutorial again and now it’s working fine. I think we can put this down to driver error…Somehow I must have clicked / not clicked something at some point.

Best wishes Ian

14 Nov 2010, 13:08
Generic-user-small

Tim Isted (105 posts)

Hi Ian,

For the sake of completeness, and in case anyone else has this problem, this is what cured the problem for the original project you emailed me:

un-tick the “include in target” checkbox for the @NotifyingClass.m@ file

# clean the project (Shift-Cmd-K) # build the project # run it to check the error still occurrs (as it should, now that files definitely aren’t included) # re-tick the “include in target” checkbox # rebuild the project

The “include in target” checkbox is this one: http://embr.it/checkbox (your code coloring will likely be different to mine)

If you can’t see the split view shown in that image, press (Shift-Cmd-E).

This would appear to have been caused by a very strange glitch in Xcode itself. At some point, it convinced itself that it was compiling and including the file, when it wasn’t. I don’t know the exact reason why this might happen, but the above steps essentially tell it “Don’t include the file” (which it isn’t anyway), then “Do include the file” thereby ‘resetting’ its mistake.

Thanks, Tim

27 Nov 2010, 19:19
Generic-user-small

Dr Ian Hocking (5 posts)

Hi Tim

Thanks again for sorting this out.

Cheers Ian

04 Jan 2013, 08:47
Generic-user-small

Ronald Hofmann (1 post)

Hi Tim, I have the same problem with Xcode 4.6 although slightly different.

I used to have a class TimeNumbers in my project which was not necessary anymore some day and I removed it from my project (reference).

Since that point of time I have the problem that I get this message in the console when building the project: ‘Unknown class ‘TimeNumbers’, using ‘NSObject’ instead. Encountered in Interface Builder file at path /Users/ronny/Applications/Egg&Breakfast.app/Contents/Resources/de.lproj/MainMenu.nib’

OK, MainMenu.nib is xml and I took a closer look at the contents. I found that the class TimeNumbers was still in the nib file.

When I add TimeNumbers again (and also put it to compile sources) the message is gone.

The error message doesn´t really prevent my code from working but I´m interested what I´m doing wrong.

Any ideas?

Greetings from Switzerland, Ronald Hofmann

  You must be logged in to comment