开发者

getting memory leak

开发者 https://www.devze.com 2023-02-05 01:46 出处:网络
NSDictionary *headerFields = [(NSHTTPURLResponse*)response allHeaderFields]; NSURL *url = [NSURL URLWithString:@\"https://secure.tesco.com/clubcard/clubcard/main.asp\"];
NSDictionary *headerFields = [(NSHTTPURLResponse*)response allHeaderFields]; 
    NSURL *url = [NSURL URLWithString:@"https://secure.tesco.com/clubcard/clubcard/main.asp"];
    NSArray *theCookies = [NSHTTPCookie cookiesWit开发者_如何学ChResponseHeaderFields:headerFields forURL:url];

   self.mHeaderResponseData= [NSString stringWithFormat:@"%@", [theCookies objectAtIndex:2]];

mHeaderResponseData having retain property ...

this code is inside connectionDidRecievResponse method

any idea ... and i am releasing mHeaderResponseData in dealloc


Did you alloc and initialize mHeaderResponseData variable in other functions also or not.

if yes then you need to release it when you are doing stringWithFormat:

and

This line will create mHeaderResponseData without incrementing the retain count.

self.mHeaderResponseData= [NSString stringWithFormat:@"%@", [theCookies objectAtIndex:2]];

so instead use initWithFormat:

0

精彩评论

暂无评论...
验证码 换一张
取 消