THis is my class
@interface BGImageBookController () <BGPageViewControllerDelegateProtocol>
@property (strong, nonatomic) IBOutlet UIPageViewController *pvc;
It contains a property called pvc. pvc is NOT a read only property.
However, BGImageBookController also supports a protocol
@protocol BGPageViewControllerDelegateProtocol <NSObject>
@property (readonly,nonatomic) UIPageViewController * pvc;
-(void)reDrawEverything;
@end
In the protocol, pvc is a read only property. That's because the PageViewControllerDelegate does not ever need to change pvc.
Well this causes conflicts.
I got:
/business/Dropbox/badgers/BadgerNew/BGImageBookController.m:30:17: Readonly IBOutlet property when auto-synthesized may not work correctly with 'nib' loader
I tried to fix that by adding
@dynamic pvc;
Then I got this run time error
*** Terminating app due to uncaught exception 'NSUnknownKeyException', reason: '[<BGImageBookController 0x1e0df340> setValue:forUndefinedKey:]: this class is not key value coding-compliant for the key pvc.'
*** First throw call stack:
(0x3120e2a3 0x38eb397f 0x3120df99 0x31a7b1d9 0x31a76f2b 0x3119461b 0x331b331d 0x331b2b9b 0x330ab03d 0x3303546d 0x14b7c9 0x14b8fd 0x14b9b1 0xc8eeb 0xc705f 0xc71a7 0x33133d89 0x330fb3f5 0x332e8a39 0x3301f82f 0x3301e293 0x330291e7 0x33028db3 0x33016801 0x3301611b 0x34d195a3 0x34d191d3 0x311e3173 0x311e3117 0x311e1f99 0x31154ebd 0x31154d49 0x34d182eb 0x3306a301 0x37299 0x37220)
libc++abi.dylib: terminate called throwing an exception
So basically BGImageBookController supports the property pvc in 2 ways.
It has an IBOutlet property called pvc
It supports a protocol that requires a read only property called pvc.
I thought everything should work fine. After all, having a non read only property means also supporting -(UIPageViewController *) pvc;
Of course I can just change the variable name in protocol and reimplement that in my class
-(UIPageViewController *) pvc1
{
return self.pvc;
}
But I think I should be able to get this even without doing that. After all, the class already supports
-(UIPageViewController *) pvc
Namely it's a property named pvc whose type is UIPageViewController