Uisearchcontroller attempting to load the view of a view controller while it's deallocating is isn't allowed and may result In undefined behavior

Source: Internet
Author: User

Attempting to load the view's a view controller while it's deallocating is isn't allowed and may result in undefined Behav IOR (<UISearchController:0x7f9c28c9d740>)

This kind of error is a headache, because this is the iOS9.0 and other errors, specifically, when Uisearchbar appears, the console will enter this type of information:

In fact, it is also very good to solve, can be added in the Dealloc method:

[self. Searchcontroller. View. Superview Removefromsuperview];

You can also add this code to the location where you use Uisearchcontroller:

OC adds this sentence:

[Self.searchcontroller loadviewifneeded];

Swift 's plus this:

self. resultsearchcontroller.loadviewifneeded ()

You can self-verify that the newly added code is sitting in the method or not, as long as the execution will solve the problem.

Uisearchcontroller attempting to load the view of a view controller while it's deallocating is isn't allowed and may result In undefined behavior

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.