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