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