Note that there are some explanatory texts on larger screens.

plurals
  1. POCrash with rotating SearchDisplayController: [Object _existingView]: unrecognized selector sent to instance
    primarykey
    data
    text
    <p>I've seen various question on this topic but never found a good answer for it.</p> <p>I have an App that's using UITableViewController and that instantiates a SearchDisplayController for it.</p> <p>I receive random crash from my crash reporter that every time looks like</p> <pre><code>[Object _existingView]: unrecognized selector sent to instance </code></pre> <p>Object can be anything, there is absolutely no rule, except that it is always an internal object, not one from the App code.</p> <p>It can affect different version of iOS up to 6.0.</p> <p>It looks like a SearchDisplayController have not been deallocated and is sending rotation messages to internal objects (see crash report below)</p> <p>It is really strange and the code above is the only place where I instantiate a searchDisplayController in all the project classes.</p> <p>I will never post something here if I was able to reproduce this issue, but unfortunately I've not been able to reproduce it, even by trying to navigate trough dozens of UITableViewController in the App itself and sending memory warning to the simulator.</p> <p>If anyone did experience this issue previously, it could be interesting and maybe we can provide a definitive answer on this topic (several post on this)</p> <p>This is how the searchBar and SearchDisplayController are created:</p> <pre><code>UISearchBar *searchBar = [[[UISearchBar alloc] init] autorelease]; searchBar.barStyle = UIBarStyleBlack; self.createdSearchDisplayController = [[UISearchDisplayController alloc] initWithSearchBar:searchBar contentsController:self]; self.searchDisplayController.searchResultsDelegate = self; self.searchDisplayController.searchResultsDataSource = self; self.searchDisplayController.delegate = self; searchBar.frame = CGRectMake(0, 0, 0, 38); self.tableView.tableHeaderView = searchBar; </code></pre> <p>And after reading some answers, I've upgraded the dealloc method to nil delegates even though it should be a weak link. This is how I'm deallocating this in the dealloc (sorry, pre-ARC code, I still have to upgrade):</p> <pre><code>[[NSNotificationCenter defaultCenter] removeObserver:self]; fetchedResultsController.delegate = nil; self.searchDisplayController.delegate = nil; self.searchDisplayController.searchResultsDelegate = nil; self.searchDisplayController.searchResultsDataSource = nil; [createdSearchDisplayController release]; </code></pre> <p>I'm still unsure if the SearchDisplayController is released properly, even though I don't see any other mean to do it as searchDisplayController is a read-Only property.</p> <p>Using Instruments I do not see any leak by using the leak trace but when looking at the allocation trace there, it seems the system keeps some reference to searchDiplayController, even after sending several memory warnings in the simulator.</p> <p>Below the crash report, with no mention of our App, except the first statements main and start:</p> <pre><code>0 CoreFoundation 0x35b0b88f __exceptionPreprocess + 162 1 libobjc.A.dylib 0x3372f259 objc_exception_throw + 32 2 CoreFoundation 0x35b0ea9b -[NSObject doesNotRecognizeSelector:] + 174 3 CoreFoundation 0x35b0d915 ___forwarding___ + 300 4 CoreFoundation 0x35a68650 _CF_forwarding_prep_0 + 48 5 UIKit 0x334d4ebb -[UISearchDisplayController windowWillAnimateRotation:] + 126 6 Foundation 0x34f254ff __57-[NSNotificationCenter addObserver:selector:name:object:]_block_invoke_0 + 18 7 CoreFoundation 0x35ad7547 ___CFXNotificationPost_block_invoke_0 + 70 8 CoreFoundation 0x35a63097 _CFXNotificationPost + 1406 9 Foundation 0x34e993eb -[NSNotificationCenter postNotificationName:object:userInfo:] + 66 10 UIKit 0x332efa57 -[UIWindow _setRotatableClient:toOrientation:updateStatusBar:duration:force:isRotating:] + 3450 11 UIKit 0x33380fa7 -[UIWindow _setRotatableClient:toOrientation:updateStatusBar:duration:force:] + 46 12 UIKit 0x33380f37 -[UIWindow _setRotatableViewOrientation:duration:force:] + 70 13 UIKit 0x3324fa01 -[UIWindow _updateToInterfaceOrientation:duration:force:] + 108 14 UIKit 0x33236cff -[UIWindow _updateInterfaceOrientationFromDeviceOrientation:] + 162 15 UIKit 0x332500c7 -[UIWindow _updateInterfaceOrientationFromDeviceOrientationIfRotationEnabled:] + 74 16 Foundation 0x34f254ff __57-[NSNotificationCenter addObserver:selector:name:object:]_block_invoke_0 + 18 17 CoreFoundation 0x35ad7547 ___CFXNotificationPost_block_invoke_0 + 70 18 CoreFoundation 0x35a63097 _CFXNotificationPost + 1406 19 Foundation 0x34e993eb -[NSNotificationCenter postNotificationName:object:userInfo:] + 66 20 UIKit 0x33210deb -[UIDevice setOrientation:animated:] + 214 21 UIKit 0x3320c16f -[UIApplication handleEvent:withNewEvent:] + 2718 22 UIKit 0x3320b567 -[UIApplication sendEvent:] + 54 23 UIKit 0x3320af3b _UIApplicationHandleEvent + 5826 24 GraphicsServices 0x337fd22b PurpleEventCallback + 882 25 CoreFoundation 0x35adf523 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE1_PERFORM_FUNCTION__ + 38 26 CoreFoundation 0x35adf4c5 __CFRunLoopDoSource1 + 140 27 CoreFoundation 0x35ade313 __CFRunLoopRun + 1370 28 CoreFoundation 0x35a614a5 CFRunLoopRunSpecific + 300 29 CoreFoundation 0x35a6136d CFRunLoopRunInMode + 104 30 GraphicsServices 0x337fc439 GSEventRunModal + 136 31 UIKit 0x33239cd5 UIApplicationMain + 1080 32 AppName 0x0001a1cb main + 66 33 AppName 0x00016348 start + 40 </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload