Application is modifying the AutoLayout engine from a background thread solution

Source: Internet
Author: User

Nsurlsession *session =[Nsurlsession sharedsession]; __weakIDSafeself =Self ; Nsurlsessiondatatask*task = [Session datataskwithrequest:req completionhandler:^ (NSData * _nullable data, Nsurlresponse * _Nullable response, Nserror *_nullable Error) {Self.webdata=data; if(self.webdata) {//If you get the dataNsxmlparser *paser =[[Nsxmlparser Alloc]initwithdata:self.webdata]; Paser.Delegate=Self ;        [Paser parse]; }                if([Self.parseresults isequaltostring:@"false"]) {Uialertcontroller*alert = [Uialertcontroller alertcontrollerwithtitle:@"Logon Failure"Message@"Account password Error"Preferredstyle:uialertcontrollerstylealert]; Uialertaction*action = [Uialertaction actionwithtitle:@"oops"Style:uialertactionstyledefault Handler:nil];            [Alert addaction:action]; //Dispatch_async (Dispatch_get_main_queue (), ^{[self Presentviewcontroller:alert animated:yes completion:nil]; //});                    }            }];    [Task resume]; 
[Self Presentviewcontroller:alert animated:yes Completion:nil] Statement error, information is:

Application is modifying the AutoLayout engine from a background thread, which can leads to engine corruption and weird CRA  Shes. This would cause an exception in a future release.

Workaround:

  Dispatch_async (Dispatch_get_main_queue (), ^{                [self presentviewcontroller:alert animated:yes Completion:nil ];            });

Application is modifying the AutoLayout engine from a background thread solution

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.