storyboard - Having a zombie issue on UISearchDisplayController -


i having zombie while using uisearchdisplaycontroller uitableview.

the uisearchdisplaycontroller (and rest of view) set via interface builder (storyboard on xcode 5 , using arc , ios 7 only).

the searchdisplaycontroller used these 2 methods

-(bool)searchdisplaycontroller:(uisearchdisplaycontroller *)controller shouldreloadtableforsearchstring:(nsstring *)searchstring {     [self filtercontentforsearchtext:searchstring scope:      [[self.searchdisplaycontroller.searchbar scopebuttontitles] objectatindex:[self.searchdisplaycontroller.searchbar selectedscopebuttonindex]]];     return yes; }  -(bool)searchdisplaycontroller:(uisearchdisplaycontroller *)controller shouldreloadtableforsearchscope:(nsinteger)searchoption {     [self filtercontentforsearchtext:self.searchdisplaycontroller.searchbar.text scope:      [[self.searchdisplaycontroller.searchbar scopebuttontitles] objectatindex:searchoption]];     return yes; } 

instruments giving me information

#   event type  ∆ refct refct   timestamp   responsible library responsible caller 0   malloc  +1  1   00:10.739.188   uikit   -[uitableview settableheaderbackgroundcolor:] 1   retain  +1  2   00:10.739.214   uikit   -[uiview(internal) _addsubview:positioned:relativeto:] 2   retain  +1  3   00:10.739.234   uikit   -[uisearchdisplaycontroller _configuresearchbarfortableview] 3   retain  +1  4   00:10.739.291   uikit   -[uiview(hierarchy) subviews] 4   retain  +1  5   00:10.771.238   uikit   -[uiview(hierarchy) subviews] 5   retain  +1  6   00:10.782.890   quartzcore  -[calayer layoutsublayers] 6   release -1  5   00:10.782.891   quartzcore  -[calayer layoutsublayers] 7   release -1  4   00:10.792.538   quartzcore  ca::transaction::observer_callback(__cfrunloopobserver*, unsigned long, void*) 8   release -1  3   00:15.446.447   uikit   -[uitableview dealloc] 9   release -1  2   00:15.446.661   uikit   -[uiview(internal) _invalidatesubviewcache] 10  release -1  1   00:15.446.679   uikit   -[uiview(hierarchy) removefromsuperview] 11  release -1  0   00:15.446.744   uikit   -[uitableview settableheaderbackgroundcolor:] 12  zombie      -1  00:15.446.765   uikit   -[uisearchdisplaycontroller _cleanupsearchbar] 

i tried clean uisearchdisplaycontroller in dealloc method this

-(void)dealloc {     self.searchdisplaycontroller.searchresultstableview.delegate = nil;     self.searchdisplaycontroller.delegate = nil;     self.searchdisplaycontroller.searchbar.delegate = nil;     self.searchdisplaycontroller.searchresultsdelegate = nil;     self.searchdisplaycontroller.searchresultsdatasource = nil; } 

but didn't work.

have idea of doing wrong ?

thanks help.

i think i've been able work around problem. here's question talks workarounds:

uisearchdisplaycontroller causes crash after viewdidunload

so added:

@property (nonatomic, weak) iboutlet uisearchbar *searchbar; @property (nonatomic) uisearchdisplaycontroller *searchcontroller; 

and in viewdidload:

uisearchdisplaycontroller *searchcontroller = [[uisearchdisplaycontroller alloc] initwithsearchbar:[self searchbar] contentscontroller:self]; [searchcontroller setdelegate:self]; [searchcontroller setsearchresultsdelegate:self]; [searchcontroller setsearchresultsdatasource:self]; [self setsearchcontroller:searchcontroller]; 

and in dealloc:

[self setsearchcontroller:nil]; 

that seems have solved it.


Comments

Popular posts from this blog

java.util.scanner - How to read and add only numbers to array from a text file -

rewrite - Trouble with Wordpress multiple custom querystrings -