I'm having a very specific problem, I'm working with a DAO (data access object) that takes varius states, these states are passed into an init method and are then used.
Now the problem that I'm having is that I can't seem to pass a concrete state into the init
method, I always get an
implicit conversion of an objective-c pointer to __autoreleasing id is disallowed with ARC
The code:
-(DAOObject *)makeSpecificDataAccessObject{
SQLiteState* localstate = [[SQLiteState alloc] initWithTableName:@"TableName"];
DAOObject* specificDAO = [[DAOObject alloc] initWithLocalState:localstate]; //where error happens
return specificDAO;
}
@interface DAOObject : NSObject <SettingsListenerProtocol>
-(id)initWithLocalState:(id<StateProtocol> *)LocalState;
@end
@interface SQLiteState : NSObject <StateProtocol>
-(id)initWithTableName:(NSString *)tableName;
@end
Remove the star *
in
-(id)initWithLocalState:(id<StateProtocol> *)LocalState;
id
is already defined as a pointer to an instance of a class.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With