application is modifying the autolayout engine from a background thread解决方案

NSURLSession *session = [NSURLSession sharedSession];
    __weak id safeSelf = self;
    NSURLSessionDataTask *task = [session dataTaskWithRequest:req completionHandler:^(NSData * _Nullable data, NSURLResponse * _Nullable response, NSError * _Nullable error) {
        self.webData = data;
        if (self.webData) {
            // 如果获取到了数据
            NSXMLParser *paser = [[NSXMLParser alloc]initWithData:self.webData];
            paser.delegate = self;
            [paser parse];
        }

        if ([self.parseResults isEqualToString:@"false"]) {
            UIAlertController *alert = [UIAlertController alertControllerWithTitle:@"登录失败" message:@"帐号密码错误" 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]语句报错,信息为:

application is modifying the autolayout engine from a background thread, which can lead to engine corruption and weird crashes.  This will cause an exception in a future release.

解决方法:

  dispatch_async(dispatch_get_main_queue(), ^{
                [self presentViewController:alert animated:YES completion:nil];
            });
 
时间: 2024-10-05 20:25:44

application is modifying the autolayout engine from a background thread解决方案的相关文章

This application is modifying the autolayout engine from a background thread, which can lead to engine corruption and weird crashes.

1 2015-09-28 17:32:03.098 天天送[2079:1664555] This application is modifying the autolayout engine from a background thread, which can lead to engine corruption and weird crashes. This will cause an exception in a future release. 2 Stack:( 3 0 CoreFound

iOS之崩溃处理:This application is modifying the autolayout engine from a background thread

一.错误提示 今天在开发的时候遇到一个崩溃问题,"This application is modifying the autolayout engine from a background thread, which can lead to engine corruption and weird crashes.  This will cause an exception in a future release."如图所示 二.错误写法 先来看一下代码的写法,如图所示: 三.错误原因

This application is modifying the autolayout engine from a background thread, which can lead to engine corruption and weird crashes. This will cause an exception in a future release.

一,经历 <1> 使用SDWebImage下载 成功图片后,将图片设置给 self.imageView.image,提示如题所示的错误提示. <2>第一反应就是慢慢注释掉代码进行调试,结果发现是在成功的回调中出事了,代码如下: 1 - (void)setupDownloadImage{ 2 NSURL *url = [NSURL URLWithString:@"http://i4.pdim.gs/dmfd/200_200_100/t01f117f76fc58c257c.g

后台打印:This application is modifying the autolayout engin from a background thread,which can lead to engine corruption and weird crashes可能是因为没有在主线程刷新UI

后台打印:This application is modifying the autolayout engin from a background thread,which can lead to engine corruption and weird crashes可能是因为没有在主线程刷新UI

autolayout也会锁死

This application is modifying the autolayout engine from a background thread, which can lead to engine corruption and weird crashes.  This will cause an exception in a future release.

15/10-16/6开发笔记

添加同一个控件多次到父控件,最终只会添加一个该控件 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - TableView中设置backgroundView,设置ImageView出不来? 因为target为7,设置图片只有8才可以 - - - - - - - - - - - - - - - - - - - - - -

error = Error Domain=NSCocoaErrorDomain Code=3840

json解析,同样的请求,有一个请求,无反应.纠结了几天,终于解决了. error = Error Domain=NSCocoaErrorDomain Code=3840 "Unescaped control character around character 168." UserInfo={NSDebugDescription=Unescaped control character around character 168.} 报错信息如上: 这个原因,是因为服务器返回的字符串里面

iOS 混合网页开发 xcode7 线程问题

xcode6是没有问题的 在利用JavaScriptCore与H5交互时出现异常提示: This application is modifying the autolayout engine from a background thread, which can lead to engine corruption and weird crashes.  This will cause an exception in a future release. 解决办法是:交互的跳转要在主线程进行 dis

Xcode7.0错误

昨天更新Xcode7.0之后,首先遇到了http请求的问题,百度了一下找到了解决方法,修改info.plist文件,info.plist-->Open As-->Souce Code  在</dict>之前添加 <dict> <key>NSAllowsArbitraryLoads</key> <true/> </dict> 然后继续运行APP,发现在使用delegate获取网络请求结果的时候,没有办法直接addsubvie