• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: #import errors and @class warnings
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: #import errors and @class warnings


  • Subject: Re: #import errors and @class warnings
  • From: Andre Doucette <email@hidden>
  • Date: Thu, 30 Apr 2009 13:14:15 -0600

Ah, that makes sense. I knew the @class thing was working, but it was so annoying to never know if the method call was correct or not.

Adding the .h files to the respective .m files fixed the issue though.

Thanks so much!
Andre

On 30-Apr-09, at 11:07 AM, Sherm Pendley wrote:

On Thu, Apr 30, 2009 at 2:55 AM, Andre Doucette <email@hidden > wrote:

It seems that it doesn't like the double #import, but I thought the whole idea behind #import was that it ensured one-time includes.

#import guards against multiple includes, but not circular includes. So you can't have a.h #import b.h, and b.h #import a.h.

If I take either #import "NetworkController.h" or #import "AppController.h" and change them to forward declarations (that is, @class NetworkController; or @class AppController;), this works, but then I get a sprinkling of errors everywhere saying that methods may not be implemented.

You're on the right track, but using @class in your header file is only one of the two necessary steps. The second step is to use #import in your .m files - i.e. in AppController.m, you would #import "NetworkContoller.h", and in NetworkController.m, #import "AppController.h".

sherm--

--
Cocoa programming in Perl: http://camelbones.sourceforge.net


_______________________________________________

Cocoa-dev mailing list (email@hidden)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


References: 
 >#import errors and @class warnings (From: Andre Doucette <email@hidden>)
 >Re: #import errors and @class warnings (From: Sherm Pendley <email@hidden>)

  • Prev by Date: Re: didReceiveMemoryWarning Confusion
  • Next by Date: Re: Scheduling a selector when a thread completes
  • Previous by thread: Re: #import errors and @class warnings
  • Next by thread: [ANN] RegexKitLite 3.0 - Release Canidate, feedback wanted
  • Index(es):
    • Date
    • Thread