In WebServiceAPI.h, which I referred in the code below, i declared a protocol with a required metod -(void) apiFinished:(WebServiceAPI *)api. When compiling the code i get this error: WebServiceAPI.h:13: error: expected ‘)’ before ‘WebServiceAPI’ (line 13 is where the method of the protocol is declared). where am I doing wrong?
#import <Foundation/Foundation.h>
@protocol WebServiceAPIDelegate
@required
-(void) apiFinished:(WebServiceAPI *)api;
@end
@interface WebServiceAPI : NSObject{
NSString *address;
NSMutableData *dataWebService;
}
@property (nonatomic, assign) id <WebServiceAPIDelegate>delegate;
@property(nonatomic, retain) NSString *address;
@property(nonatomic, retain) NSMutableData *dataWebService;
@end
The problem is that
WebServiceAPIDelegatedoesn’t know about the classWebServiceAPIwhen it is defined. Add a@classdirective before you create WebServiceAPIDelegate @protocol declaration.