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 8731229
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T09:11:13+00:00 2026-06-13T09:11:13+00:00

I have two protocols BaseDAO, and ICategoryDAO. ICategoryDAO adopt BaseDao. Class categoryDao adopt ICategoryDao.

  • 0

I have two protocols BaseDAO, and ICategoryDAO. ICategoryDAO adopt BaseDao. Class categoryDao adopt ICategoryDao.

The below code is the initializer method of serviceRepo class (sub class of NSObject). Here I perform the type check and etc.

 - (id)init {
        self = [super init];
        if (self) {
            self.dict  = [NSMutableDictionary new];
            [self.dict setValue:[CategoryDao description] forKey:[NSString stringWithFormat:@"%s",[@protocol(ICategoryDao) name]]];
        }
        return self;
    }

the problem is Xcode always pop the error Receiver type ‘Protocol’ for instance message is a forward declaration in this call -> [@protocol(ICategoryDao) name].
Im using ARC, it works fine on non ARC project.
I couldn’t find any solution in the internet, so finally Im here. How can I solve this issue, am I doing anything wrong here.

This is the structure of the protocols and classes;

BaseDao

#import <Foundation/Foundation.h>

@protocol BaseDao <NSObject>

ICategoryDAO

#import <Foundation/Foundation.h>
#import "BaseDao.h"

@protocol ICategoryDao <BaseDao>

CategoryDAO

#import <Foundation/Foundation.h>
#import "ICategoryDao.h"

@interface CategoryDao : NSObject <ICategoryDao>

ServiceRepo

#import <Foundation/Foundation.h>

@interface ServiceRepository : NSObject

ServiceRepo.m

#import "ServiceRepository.h"
#import "CategoryDao.h"
#import "BaseDao.h"

@implementation ServiceRepository
  • 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-13T09:11:15+00:00Added an answer on June 13, 2026 at 9:11 am

    Please try below code that might help you.

    [self.dict setValue:[CategoryDao description] forKey:[NSString stringWithFormat:@"%s",NSStringFromProtocol(@protocol(ICategoryDao))];
    

    NSProtocolFromString
    Returns a the protocol with a given name.

    Protocol *NSProtocolFromString (
       NSString *namestr
    );
    

    Parameters

    namestr
    The name of a protocol.

    Return Value

    The protocol object named by namestr, or nil if no protocol by that name is currently loaded. If namestr is nil, returns nil.

    • 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
I have two classes (MVC view model) which inherits from one abstract base class.
I have two columns say Main and Sub . (they can be of same
I have two files defining protocols, for implementing the observer pattern, and I'm getting
I have two protocols declared in my project. The first one I wrote is
I have a simple webservice with two webmethods. https://localhost/Sub/WS/Dash.asmx/test_error_methodnameXXXXXXXXXXX When i call the above
I have a Network class, which I want two virtual functions which I am
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.