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

  • SEARCH
  • Home
  • 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 8493785
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T23:07:03+00:00 2026-06-10T23:07:03+00:00

I have two protocols declared in my project. The first one I wrote is

  • 0

I have two protocols declared in my project. The first one I wrote is named SSSelectingCategory.h

#import <Foundation/Foundation.h>

@protocol SSSelectingCategory <NSObject>

@required
@property (nonatomic, strong) SSCategory *selectedCategory;

@end

The second one is SSSelectingIcon.h

#import <Foundation/Foundation.h>

@protocol SSSelectingIcon <NSObject>

@required
@property (nonatomic, strong) SSIcon *selectedIcon;

@end

The strange thing is that the first protocol compiles without any error or warning, while the second one is throwing the Unknown type name 'SSIcon'.

I know the answer to this problem is to use a forward-class declaration in my second protocol like this:

#import <Foundation/Foundation.h>
@class SSIcon;

@protocol SSSelectingIcon <NSObject>

@required
@property (nonatomic, strong) SSIcon *selectedIcon;

@end

But now this makes me think the SSSelectingCategory.h protocol shouldn’t have compiled at all in the first place, as I didn’t put any explicit #import or forward-class declaration of any sort.

I could quiet the compiler and go on coding, but I want to understand if there’s something weird going on with Xcode or if I’m missing some fine point, as both protocols are really simple. Could there be a problem with the SSCategory and/or SSIcon classes, as they’re both NSManagedObjects and there’s a relationship connecting the two?

  • 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-10T23:07:05+00:00Added an answer on June 10, 2026 at 11:07 pm

    The compiler compiles the .m files, which in turn include the .h files.

    So I assume that in the .m file where “SSSelectingCategory.h” is included, SSCategory is defined before, so that the compiler has no problem compiling the protocol.

    If, on the other hand, “SSSelectingIcon.h” is included without having defined SSIcon before, the compiler would abort with an error there.

    In any case, it makes sense to include the required interfaces in the .h file (or forward declare the required classes), because that enables code-completion in Xcode.

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

Sidebar

Related Questions

Well, I have these two protocols: @protocol ivAuthorizationProtocol <NSObject> -(void)loginReply:(ivSession*)session; @end @protocol ivServerListsProtocol <NSObject>
Imagine I have two protocols: @protocol A @end and @protocol B <A> // Protocol
Have two actionsheet buttons and one modalviewcontroller on mainviewcontroller in application. Now for two
I have two classes (MVC view model) which inherits from one abstract base class.
I trying to display image in picture box. The application have two part. First
I have two files defining protocols, for implementing the observer pattern, and I'm getting
I have two subdomains www.example.com and api.example.com . On a page from first domain
I have two objects, both of which are view controllers. The first (Ill call
I have two protocols communicating with each other. They are defined in the same
Have two folders with approx. 150 java property files. In a shell script, how

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.