Autosynthesis in iOS6 still requires @synthesize
- to generate accessor methods for properties defined in a
@protocol
.
- to generate a backing variable when you included your own accessors.
The second case can be verified like this:
#import <Foundation/Foundation.h>
@interface User : NSObject
@property (nonatomic, assign) NSInteger edad;
@end
@implementation User
@end
Type: clang -rewrite-objc main.m
and check that the variable is generated. Now add accessors:
@implementation User
-(void)setEdad:(NSInteger)nuevaEdad {}
-(NSInteger)edad { return 0;}
@end
Type: clang -rewrite-objc main.m
and check that the variable is NOT generated. So in order to use the backing variable from the accessors, you need to include the @synthesize
.
It may be related to this:
Clang provides support for autosynthesis of declared properties. Using
this feature, clang provides default synthesis of those properties not
declared @dynamic and not having user provided backing getter and
setter methods.