How to release an object declared into a method and passed to another method?

前端 未结 3 795
鱼传尺愫
鱼传尺愫 2021-01-29 09:45

Any idea on how to release the UIImage object picture in this case:

- (void)connectionDidFinishLoading:(NSURLConnection *)connection
{

    UIIm         


        
3条回答
  •  北海茫月
    2021-01-29 10:30

    I think: [delegate ThumbDidLoad:self.indexPathInTableView Image:[picture autorelease]];

    or

     [delegate ThumbDidLoad:self.indexPathInTableView Image:picture];
     [picture release];
    

    But I see two problems in your code - leaks at picture = payload; and [payload release]; can release image, that is also indicated by the picture

提交回复
热议问题