当前位置: 代码迷 >> 综合 >> This application is modifying the autolayout engine from a background thread, which can lead to engi
  详细解决方案

This application is modifying the autolayout engine from a background thread, which can lead to engi

热度:61   发布时间:2023-12-11 13:52:31.0

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.

ios9里触发js方法使用时,遇到了这个问题,代码如下:

self.context[@"sendMoney"] = ^(NSString *str){NSLog(@"--sendMoney----%@",str);[weakSelf pushViewController:@"TradeViewController" withArgment:nil];};

找了下资料说写在GCD里就没问题,修改如下:

self.context[@"sendMoney"] = ^(NSString *str){NSLog(@"--sendMoney----%@",str);dispatch_async(dispatch_get_main_queue(), ^{[weakSelf pushViewController:@"TradeViewController" withArgment:nil];});};

这样就没问题了,看来ios9里坑不少。

  相关解决方案