我继承了NSObject:
#import <Foundation/Foundation.h>
@interface STObject : NSObject {
NSString *message_type;
NSString *twitter_in_reply_to_screen_name;
}
@property(nonatomic, copy) NSString *message_type;
@property(nonatomic, copy) NSString *twitter_in_reply_to_screen_name;
@end
我的实现如下:
#import "STObject.h"
@implementation STObject
@synthesize message_type, twitter_in_reply_to_screen_name;
@end
我是否需要为我释放字符串的两个属性创建一个dealloc方法?
答案 0 :(得分:4)
是。使用-release
时,属性不会自动为@synthesize
。
-(void)dealloc {
[message_type release];
[twitter_in_reply_to_screen_name release];
[super dealloc];
}