您的位置:首页 > 理论基础 > 计算机网络

LGPhotoBrowser 网络请求图片 报出This application is modifying the autolayout engine from a background thread

2016-08-31 11:51 537 查看
由于自己水平有限 在项目中集成了一个大牛写的仿微信的拍照 相册 图片游览器 集合的开源api LGPhotoBrowser 那么问题就来了 可能是没有更新到最新api吧 后面有时间再去仔细研究

切入正题

项目中需要做 点击web 界面上的图片是 可以实现放大多张查看的功能 其实就是要做一个url的图片游览器

集成很简单



但是 在获取网络图片的时候 报出了这个

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里坑不少。

网址链接

http://blog.csdn.net/quanqinyang/article/details/49516593

以上是另一位大牛写的 自己也遇到过这样的问题 贴上差异代码

1 原生态的



2 改后的



于是 问题就决绝了 哈哈哈哈哈哈 还是楼上大神那句话 看来ios9里坑不少啊。
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: 
相关文章推荐