开发者

app crashes due to deallocating a view

开发者 https://www.devze.com 2023-03-07 01:22 出处:网络
hi friends i am developing a app where there many templates.swipe towards left navigates to thr next template and towards right navigates to the previous template.I have a method which gets called as

hi friends i am developing a app where there many templates.swipe towards left navigates to thr next template and towards right navigates to the previous template.I have a method which gets called as soon as i swipe towards any direction which clears all the views related to the previous template and some other functionality.

i have a view "bodyBgView" which gets added for all templates except one templates(wordSearch template).the same is released every time i swipe (in the method that is called when the swipe id done) . when i swipe after visiting the template(wordSearch template) the app is getting crashed. when i placed debugger i could see the debugging gets terminated at the release statement i.e [bodyBgView release];

the method is mandatory with the release statement b'coz all other templates depend on the method.how can i overcome the situation to get all the templates work fine.

to be precise releasing a view which is already deallocat开发者_运维知识库ed should not abort my application.

plz help me

Tnx in advance


i solved my issue by assigning nil after the view is released.

[bodyBgView release];
bodyBgView=nil;

then my app was not chrashing. validation on a nil returns nil thus the app doesn't get chrashed.

hope helps others who faces same issue.

thank you

0

精彩评论

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