I made a class that uses the delegate pattern and I put it in a static library. Then, I created a demo app to test the library. The demo just has a single view controller, and in the .h file, I have this:
@interface ViewController : UIViewController <AuthenticationDelegate>
@property (nonatomic, retain) IBOutlet UITextField *usernameTextField;
@property (nonatomic, retain) IBOutlet UITextField *passwordTextField;
@end
When I compile, I get an error right on the first line of the file that says:
Cannot find protocol declaration for 'AuthenticationDelegate'.
But, in the .m file for the same view controller, I have:
#import "Authentication.h"
#import "ViewController.h"
The file "Authentication.h" is the only header file in my static library, and it does declare the delegate class:
@class AuthenticationProvider;
@protocol AuthenticationDelegate <NSObject>
@optional
- (void)provider:(AuthenticationProvider *)provider didReplyWithResponse:(AuthenticationProviderResponse)response;
@end
Where am I going wrong?
Update:
If I put #import "Authentication.h
in ViewController.h, I get this:
Undefined symbols for architecture i386:
"_OBJC_CLASS_$_AuthenticationProvider", referenced from:
objc-class-ref in ViewController.o
ld: symbol(s) not found for architecture i386
clang: error: linker command failed with exit code 1 (use -v to see invocation)
I get that when I remove #import "Authentication.h
from ViewController.m also.