In my .h file I have this:
@protocol ScanBookDelegate
- (void)MethodNameToCallBack:(NSArray *)s;
@end
@property (nonatomic, weak) id <ScanBookDelegate> delegate;
In my .m file I have:
@synthesize delegate;
I get this error:
Existing ivar 'delegate' for __weak property 'delegate' must be __weak
How do I resolve this error?
I am returning an NSArray * as I am returning data from a JSON result.
UPDATE:
Here is my entire .h file –
#import <UIKit/UIKit.h>
@protocol ScanBookDelegate
- (void)MethodNameToCallBack:(NSArray *)s;
@end
@interface jabBookScan : NSObject
<NSURLConnectionDelegate, NSURLConnectionDataDelegate>
{
NSURLConnection *internalConnection;
NSMutableData *container;
id <ScanBookDelegate> delegate;
}
- (id)initWithRequest:(NSURLRequest *)req;
- (void)start;
- (NSMutableData *) lookupBook:(NSString *) isbn;
- (void)fetchedData:(NSData *)responseData;
@property (nonatomic, copy) NSURLRequest *request;
@property (nonatomic, copy) void (^completionBlock)(id obj, NSError *err);
@property (nonatomic, strong) NSDictionary *jsonRootObject;
@property NSMutableData *responseData;
@property NSURL *myURL;
@property (nonatomic, weak) id <ScanBookDelegate> delegate;
@end
Get rid of
id <ScanBookDelegate> delegate;in your {} (at the top) and it should work. You don’t need to specify that when using properties. If you really want to, then you can declare that ivar __weak so it matches your property (ivars are strong by default).