Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8048173
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T06:20:55+00:00 2026-06-05T06:20:55+00:00

Here’s what I’m trying to do: I want to put away some methods into

  • 0

Here’s what I’m trying to do:

I want to put away some methods into separate .h and .m files for a better overview of my code.

So basically I have the myViewController which I want to extend with the method myReactionOnAnimationDidEnd: as a category.

So I declared in "myCustomClasses.h" the following to extend it with my desired method:

#import "myViewController.h"
@interface myViewController (myReactionOnAnimationDidEnd)
- (void)myReactionOnAnimationDidEnd:(NSNotification *)aNotification;
@end

The implementation in "myCustomClasses.m" is:

#import "myCustomClasses.h"
#import "myViewController.h"

@implementation myViewController (myReactionOnAnimationDidEnd)    
- (void)myReactionOnAnimationDidEnd:(NSNotification *)aNotification {

    self.myLabel1.text = @"Test"; 
}
@end

The Compiler throws a build failed error “Cannot find interface declaration for ‘myViewController'”

So here’s my questions:

  1. The first weird thing is, that everything works fine if I do exactly the same for UIViewController instead of myViewController. But since myViewController is a subclass of UIViewController, why shouldn’t it work for myViewController as well(@interface iSnahViewController : UIViewController)?

  2. The other weird thing is that the @implementation in “myCustomClasses.m” works just fine if I skip on the @declaration completely. Now how can that be??

Thank you guys!
Any help much appreciated!!
Hans


Now, the funny thing is, that this very same building error comes up even if I create the category with the New File -> ObjC – Category Template. It basically creates the following two files:

in the header file:

#import "myViewController.h"

@interface myViewController (myCategories)  //<-- "Cannot find interface declaration for 'myViewController'"



@end

and with the .m file

#import "myViewController+myCategories.h"

@implementation myViewController (myCategories)


@end

And that’s already enough to bring up the error from above.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-05T06:20:57+00:00Added an answer on June 5, 2026 at 6:20 am

    I finally got it working!

    As the building error occured, I was importing the Category-.h File into the primery Class’s .h file:

    #import "myViewController+myCategories.h" //<-- in the  "myViewController.h" 
    

    which lead to the building error from above. This seems to be wrong! So don’t do that.

    I still don’t fully understand how the “myViewController” Class gets to know about it’s categories without even having their .h files imported, but as this appears to be a working way of how this is done, I wanted to share with you.

    Thanks everybody for helping!!

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Here is some simple code: DIR* pd = opendir(xxxx); struct dirent *cur; while (cur
Here's the thing: I want to add some images programmatically. The images should have
Here is a complete example. I want to forbid using A::set from objects casted
Here's what I want to do: Given a table PeopleOutfit (id int primary key,
Here's the method. I want to know if I am violating any best practices
Here's the code in AlertTableView: - (void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex{ NSInteger index = 12345; NSLog(@AlertTableView:
Basically, what I'm trying to create is a page of div tags, each has
Here is an example: I write html code inside of textarea, then I swap
Here's what I'm trying to accomplish with this program: a recursive method that checks
Here is the css: #content ul { font-size: 12px; } I am trying this:

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.