Memory Leak In line of code

前端 未结 3 797
误落风尘
误落风尘 2021-01-22 12:17

My app is working fine, but when I run instrument for checking for leaks, it shows me a leak at this line of code, in purple with a 100.0% mark:

xmlParser = [[NS         


        
3条回答
  •  醉梦人生
    2021-01-22 13:03

    You need to make NewsParser parser an instance variable and release it in the dealloc. Above, you init it, but you don't release it. Of course, you can't because it's a delegate of xmlParser. So, to make sure the object is retained, then properly released, it must be an ivar.

提交回复
热议问题