[Uiactivityindicatorview _applicationdidenterbackground:]: Message sent to deallocated instance

Source: Internet
Author: User

[Uiactivityindicatorview _applicationdidenterbackground:]: Message sent to deallocated instance


When we run my app, the app won't crash, but when we press the home button or lock the screen, the app will crash and zombie can capture the information. From the information available, the app sends a message to a Uiactivityindicatorview that has been released, causing crash. Finally check that the original is the use of the third-party package uikit+afnetworking caused by,

Again UIACTIVITYINDICATORVIEW+AFNETWORKING.M, there is the following code,


-(void) dealloc

{

nsnotificationcenter *notificationcenter = [nsnotificationcenter Defaultcenter];

#if __iphone_os_version_min_required >= 70000

[Notificationcenter removeobserver:selfname : afnetworkingtaskdidcompletenotification Object:nil];

[Notificationcenter removeobserver:selfname: Afnetworkingtaskdidresumenotificationobject:nil];

[Notificationcenter removeobserver:selfname : afnetworkingtaskdidsuspendnotification Object:nil];

#endif

[Notificationcenter removeobserver:selfname: Afnetworkingoperationdidstartnotificationobject:nil];

[Notificationcenter removeobserver:selfname : afnetworkingoperationdidfinishnotification Object:nil];

}


It is obvious that when the app goes backstage, Uiactivityindicatorview is released, and when this method is executed, the app is crash.

If you introduce uikit+afnetworking, no use of uiactivityindicatorview+afnetworking, big can remove him, so you can solve the above problem.

Hope to be of help to everyone.


Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.

[Uiactivityindicatorview _applicationdidenterbackground:]: Message sent to deallocated instance

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.