Time to remove notifications

Source: Internet
Author: User

Link

Conclusion

It's best to remove it when you don't need it.
If it is not particularly harsh, you can write directly in the dealloc function. Because dealloc the function is bound to be called.

deallocpossible problems removing in a function

Because dealloc Runloop it will be called at the end. If Runloop a notification arrives before the call, it can cause unpredictable problems.
For example, a VC is pop out, due to network delays and other reasons, in the same Runloop , a notification is thrown, then the VC will receive this pop notification. If a function that responds to notifications operates on a single instance within an app, the status of this singleton is not correct.

IOS9 no need to remove notifications in the future dealloc .

?
Forgetting to remove the observer is the reason why the crash happened.

Time to remove notifications

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.