I got that error:
/business/Dropbox/badgers/BadgerNew/BGProfileView.m:56:17: Auto property synthesis will not synthesize property declared in a protocol
I am aware that auto property synthesis will not synthesize property declared in a protocol
So I synthesize that my self.
This is the protocol:
@protocol BGIhaveNavigationController <NSObject>
@property (readonly)UINavigationController * navigationController;//This is the problematic property
@end
@protocol BGCommonProtocol <NSObject>
@end
As for the implementation
@interface BGProfileView : UIViewController
@end
is a UIViewController and as we know UIViewController has a navigationController property. So what's wrong?
Things get problematic when I use this:
@interface BGProfileView () <BGReviewsTableDelegateProtocol>
BGReviewsTableDelegateProtocol protocol inherits BGIhaveNavigationController protocol
I can remove the warning by adding:
-(UINavigationController *) navigationController
{
return self.navigationController;
}
But that's absurd. In a sense
-(UINavigationController *) navigationController
{
return self.navigationController;
}
-(UINavigationController *) navigationController
already exist through UINavigationController
Use
@dynamic navigationController;
This tells the compiler that the property implementation is 'somewhere else' and that it should trust that the requirement will be fulfilled at runtime. In practice, that means its in the superclass.
If you try to implement it yourself you'll end up with duplicate storage (so things probably won't work how you expect) or recursion.
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