-3

I have searchBar and searchDisplayController put in tabbar that is main tabbar.
When I open new viewcontroller by pushing there has no problem.

mainTabbar -> navigationController+searchController -(push after rowdidselect)-> newVC -(push)-> newVC -(push)-> ...

But when I do some present modal.

mainTabbar -> navigationController+searchController -(push after rowdidselect)-> newVC -(modal)-> newVC

Then back to searchResult

mainTabbar -> navigationController+searchController

I can't push newViewController again and got these error:

[__NSCFString setView:]: unrecognized selector sent to instance 0x8292720

what happening to me? all results just tell me about gesturecognizer.

::after I enable zombies I got this message

-[UITapGestureRecognizer retain]:message sent to deallocated instance 0xfcd83b0

I guess the TapGestureRecognizer with in cell of searchDisplayController table is deallocated. Anyone Know How to Retain them???

user1047504
  • 578
  • 7
  • 14

1 Answers1

0

You do not really provide much info about your case, but in general the error log:

[__NSCFString setView:]: unrecognized selector sent to instance 0x8292720

means that you are trying to send the setView message to the wrong object of type NSString.

Since you say that your code is working in one case, I assume this is not a problem with you sending the message to the wrong object. Rather, this is related to the proper object being deallocated, and its memory reused for an NSString object (which then receives the message).

I suspect the key might be with how you return back to search results, but you should provide more code for us to understand what is happening.

sergio
  • 68,819
  • 11
  • 102
  • 123
  • for modal I use dismissmodalViewController for push-pop I use dismissViewController to Close the ViewController ::after I enable zombies I got this message -[UITapGestureRecognizer retain]:message sent to deallocated instance 0xfcd83b0 – user1047504 Feb 17 '13 at 09:12
  • well, that confirms my hypothesis. could you show how and where you create the gesture recognizer? what I suppose is that your controller (containing the gesture recogniser) is deallocated, but the view attached to it remains there (it is not removed from its super view), so it keeps sending messages to the recogniser... but without seeing more code, I cannot say much more... – sergio Feb 17 '13 at 09:20
  • 1
    For push-pop why are you closing the viewcontroller with 'dismissViewController' instead 'popViewControllerAnimated:' ? – Reno Jones Feb 17 '13 at 09:20
  • @RenoJones: +1, I completely oversaw that! that is surely wrong, although it seems that push/pop is working correctly for the OP... – sergio Feb 17 '13 at 09:23
  • RenoJones ok I will fix that now. @sergio I'm not create any GestureRecognizer. I just use didSelectRowAtIndexpath and It crash after done everything in this method. – user1047504 Feb 17 '13 at 09:27
  • @RenoJones No Not Enjoy Yet. T^T The problem remain. I guess my problem is when I call the modal view then the default gesture recognizers in tableview of searchDisplayController are deallocated. **But I don't know how to retain them**. Can I override them? or Can I set disable to them with didselectrowatindexpath still working? or else.... – user1047504 Feb 17 '13 at 09:40
  • Hold on, It seems you are doing too much when a little is required: just modify your above post with the code you have got in 'didselectrowatindexpath'. Just post everything. – Reno Jones Feb 17 '13 at 09:49
  • Solved : Problem is about IB gesture recognizer in newVC. I only move them from IB to code. the default gesture recognizer in cell of table in searchDisplayController is not available at all. – user1047504 Feb 17 '13 at 10:01