Why: "Trying to load .. upon release ...: UISearchController:

I have a root storyboard with a button that pushes ViewControllerB.

ViewControllerB has a UISortController sort UISortController .

ViewControllerB has a "reverse" method controlled by the root navigation controller.

I get the following warning:

Attempting to load the view of a view controller while it is deallocating is not allowed and may result in undefined behavior (<UISearchController: 0x7ff10258ba60>)

I used an Apple sample (membership required) to add a new UISearchController.

Has anyone come across this? How to resolve it?

+5
ios uitableview uisearchbar
Aug 05 '15 at 10:46
source share
2 answers

Instead, I recommend using the Storyboard Unwind Segues: https://developer.apple.com/library/ios/technotes/tn2298/_index.html

This insightful post also contains many very useful implementation details:

What are Unwind segues and how do you use them?

+1
Aug 05 '15 at 10:47
source share

I came across the same console error message, but pay attention to the following draft of my Xcode:

  • segues for navigation controllers should remain due to their use with a split-image controller (detailed view controller);
  • (and in accordance with the comments of @AndrewEbling above) the code does not require decoupling, since the navigation controller automatically controls (proportionally) tasks;
  • In addition, the code does not require unwinding segments, since blocks are used to set properties in the parent view.

Thanks to the comments of Leehro and Clafou in this SO answer, the console error message was suppressed using the following line of code in viewDidLoad (note that there is no need to insert this into dealloc ):

[self.searchController loadViewIfNeeded]; (Note is available in iOS 9).

+1
Mar 14 '16 at 1:05
source share



All Articles