Rits
Rits

Reputation: 5175

Adding a category to my own class

My AppDelegate class has quite a few methods. In my attempt to organize these methods I'm trying to group some of these methods in a category.

So now I have these files:

My category is ofcourse defined like this:

@interface AppDelegate (GameCenter)
// methods
@end

When I compile I get this error: 'Cannot find interface declaration for 'AppDelegate'.

I think that means I have to import a file somewhere. But what file do I have to import and where? My first thought was to import AppDelegate+GameCenter.h in AppDelegate.m. But that doesn't work. Any tips? What is the best way to handle this?

Upvotes: 1

Views: 607

Answers (1)

Sam Ritchie
Sam Ritchie

Reputation: 11038

Sounds like this error is coming from a missing

#import "AppDelegate.h"

in the header of "AppDelegate+GameCenter.h". Add that, and, of course, stick with

#import "AppDelegate+GameCenter.h"

in the header of AppDelegate.m, as you've done.

Upvotes: 3

Related Questions