very fresh to objective C, cant figure out what i am missing.
.h file
#import <Foundation/Foundation.h>
#import "RESTResponse.h"
typedef void (^Callback)(RESTResponse*);
@interface AquaUser : NSObject
....
-(void)Login:Callback;
-(void)Register:Callback;
@end
.m file
-(void)Login:(Callback) handler
{
...
RESTResponse *result = [RESTResponse new];
result.sucesss = true ;
result.response = @"Login succesfull";
handler(result);
...
}
in .m i get warning on the declaration of Login and register Conflicting parameter types in implementation of 'Login:': '_strong id' vs '_strong Callback' (aka 'void (^_strong)(RESTResponse *_strong)')
although code compile and work, i am tryinf to learn the lesson here. help appreciated.
Looks like you are missing the types in your .h file.
@interface AquaUser : NSObject
....
-(void)Login:(Callback)handler;
-(void)Register:(Callback)handler;
@end
Edit:
Just a side note, in objective c, it's best to make your methods start with a lower case character. Not a big deal but it's common practice.
Happens also if you don't #import class that is declaring used Type in your .h file and use @class instead. @class doesn't work in this case. I had an enum defined in class I only mentioned with @class and wrote function that uses that enum in .h of my other class. Switching to #import worked.
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