Xcode does not generate instance variables for properties declared in protocols without @synthesize
| Originator: | news | ||
| Number: | rdar://12670075 | Date Originated: | |
| Status: | Open | Resolved: | |
| Product: | Developer Tools | Product Version: | Xcode46-DP1 (4H90b) |
| Classification: | Other Bug | Reproducible: | Always |
Summary:
Xcode 4.5 added automatically generated instance variables so every "proeprty" gets "_property" ivar "out of box"
However that is not the case for variables declared in protocols
Steps to Reproduce:
1. Create protocol with following code
@protocol TestProtocol <NSObject>
@property (nonatomic, assign) id property;
@end
2. Create a class with following .h
@interface TestClass : NSObject <TestProtocol>
@end
and .m file:
@implementation TestClass
- (id)init
{
self = [super init];
if (!self) return nil;
_property = @YES;
return self;
}
@end
Expected Results:
This code should compile and run
Actual Results:
Produces compiler error: "Use of undeclared identifier '_property'"
Comments
Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!