次のコードがリークを引き起こしている理由について、私は理にかなっています。したがって、次のカスタム init メソッドがあります。
@property (nonatomic, retain) NSString *userId;
@property (nonatomic, retain) NSString *text;
@property (nonatomic, retain) NSString *username;
@property (nonatomic, retain) NSString *creatorName;
@property (nonatomic, retain) NSString *profilePicture;
@property (nonatomic, retain) NSString *imageId;
@property (nonatomic, retain) NSString *imageLink;
@property (nonatomic, retain) NSString *createdTime;
@property (nonatomic, retain) NSMutableArray * imageLikes;
@property (nonatomic, retain) NSMutableArray * imageComments;
@property (nonatomic, retain) NSDictionary *image;
@property (nonatomic, assign) int commentsCount;
@property (nonatomic, assign) int likesCount;
@property (nonatomic, assign) int index;
@property (nonatomic, assign) int numberOfRows;
@property (nonatomic, assign) BOOL increaseHeight;
@property (nonatomic, assign) BOOL userHasLiked;
@property (nonatomic, assign) BOOL canResetHeight;
-(id)initWithData:(NSDictionary *)data
{
self = [super init];
if (!self) {
return nil;
}
self.text = [[data valueForKey:@"caption"] valueForKey:@"text"];
self.createdTime = [[data valueForKey:@"caption"] valueForKey:@"created_time"];
self.imageId = [data valueForKey:@"id"];
self.imageLink = [data valueForKey:@"link"];
NSDictionary *from = [data valueForKey:@"user"];
self.username = [from valueForKey:@"username"];
self.profilePicture = [from valueForKey:@"profile_picture"];
self.creatorName = [from valueForKey:@"full_name"];
self.userId = [from valueForKey:@"id"];
self.userHasLiked = [[data objectForKey:@"user_has_liked"] boolValue];
self.commentsCount = [[[data valueForKey:@"comments"] valueForKey:@"count"] intValue];
self.likesCount = [[[data valueForKey:@"likes"] valueForKey:@"count"] intValue];
self.image = [data valueForKey:@"images"];
self.increaseHeight = NO;
self.numberOfRows = -1;
return self;
}
-(void) dealloc
{
[createdTime_ release];
[imageLink_ release];
[imageId_ release];
[imageLikes_ release];
[imageComments_ release];
[username_ release];
[userId_ release];
[profilePicture_ release];
[text_ release];
[creatorName_ release];
[super dealloc];
}
理由はありますか?