ios6 - NSNotification & didReceiveMemoryWarning in iOS 6 -
as of ios 6.0 , viewdidunload method deprecated. before ios 6 used removeobserver of nsnotification in viewdidunload method. since deprecated , have moved didreceivememorywarning. if app receives low memory waring , notification removed. code written in nsnotification doesn't work.
can tell me how can solve issue ?
thanks in advance.
i assume added observer in viewdidload. problem on ios 6 views not unloaded, in low memory situation. therefore, if remove observer in didreceivememorywarning, viewdidload not called again.
there 2 relative simple alternatives can choose from:
- add observer in viewwillappear, remove inviewwilldisappear.
- add observer in initxxxmethod , remove indealloc.
i is possible add observer in viewdidload , remove in didreceivememorywarning. have "manually unload" view in didreceivememorywarning, viewdidload later called again. see e.g. https://stackoverflow.com/a/15805715/1187415 sample code how forcibly unload view.
Comments
Post a Comment