NSXMLParser Leaking

后端 未结 4 961
时光说笑
时光说笑 2020-11-29 06:35

I have the following code that leaks. Instruments says that it is the rssParser object that is leaking. I \"refresh\" the XML feed and it runs the block and it leaks....

4条回答
  •  醉梦人生
    2020-11-29 06:59

    Seems this is a well know problem. See here NSURLConnection leaking. However if you set the following before initializing the parser leaking stops:

    [[NSURLCache sharedURLCache] setMemoryCapacity:0];
    [[NSURLCache sharedURLCache] setDiskCapacity:0];
    NSXMLParser *parser = [[NSXMLParser alloc]initWithContentsOfURL:URL];
    

提交回复
热议问题