• 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
Adding category @interface to header file causes IB to freak out?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Adding category @interface to header file causes IB to freak out?


  • Subject: Adding category @interface to header file causes IB to freak out?
  • From: Ryan Poling <email@hidden>
  • Date: Wed, 19 Dec 2007 15:33:07 -0800

Not quite sure what's going on here, but I ran into a weird problem with one of my projects which I've replicated in a brand new "Cocoa Application" project for an example.

1. Create a new "Cocoa Application" project in Xcode.
2. Create a controller class in your new project called "TestController".
3. Add a single outlet to your TestController called "test."
4. Add an NSObject in IB for the MainMenu and set its class to the TestController.
5. Connect the test outlet from your TestController to the default window.
6. Drag and drop the "TestController.h" file from Xcode into the IB project window and note that nothing strange happens.
7. Now, add a category interface declaration to your header file like this:


@interface TestController (TestCategory)
- (void)blah;
@end

8. Save and drag the TestController.h file into IB again, and this time note that IB complains "Outlet Unavailable. The 'test' outlet of 'Test Controller' is connected to 'Wnidow (Window)' but 'test' is no longer defined on TestController. This complaint is registered as a little warning symbol at the bottom right hand side of the IB project window; click on it to see the full warning.
9. Look at your TestController definition again, see that the outlet *is* in fact defined, scratch your head, and send an email to the cocoa-dev mailing list. ;-)


Any thoughts? I *should* be able to declare the @interface section of a category in the same .h file as the main @interface, shouldn't I?

The final .h file looks like this:


// TestController.h

#import <Cocoa/Cocoa.h>

@interface TestController : NSObject {
	IBOutlet id test;
}

@end

// Category on TestController.

@interface TestController (TestCategory)
- (void)blah;
@end


-Ryan

Ryan Poling



_______________________________________________

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


  • Follow-Ups:
    • Re: Adding category @interface to header file causes IB to freak out?
      • From: Timothy Reaves <email@hidden>
  • Prev by Date: Re: discovering if a process is busy
  • Next by Date: Re: discovering if a process is busy
  • Previous by thread: Re: Programmatically determining key equivalents with Shift key
  • Next by thread: Re: Adding category @interface to header file causes IB to freak out?
  • Index(es):
    • Date
    • Thread