> For the complete documentation index, see [llms.txt](https://tech.banchengyun.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://tech.banchengyun.com/archives/frontend/ios-10version.md).

# IOS 10.x 版本在 Taro 中的兼容性问题

**踩坑记录，Taro 在 ios 10.x.x 版本中 整个页面卡死**

## 问题描述：

此前也收到过类似的反馈，但基数很小，所以忽略了。

本次所属商家：漫滋烧肉居酒屋 活动：分销 订单数量：8600 单

收到 8-10 名用户反馈订单列表页面无法正常操作，通过收集用户数据，发现问题集中在 ios 9 和 ios 10 系统。

![stikcer](https://scrm0.cdn.banchengyun.com/material/ed4c64586c3e95c62f1c98d3e5f00c88e20258cd.png)

让我们来康康这两个版本依然健在的用户量 ![version](https://scrm0.cdn.banchengyun.com/material/7486d2e51a656833c51c0fcf379b5153cca76da4.png)

依然用着 13 以下系统的用户仅占 2%。

问题还是要解决的，我们从根源出发，模拟用户的系统。 使用 ios 开发者工具 xcode，在 components 中找到 10.3 系统并下载。 ![perferences](https://scrm0.cdn.banchengyun.com/material/64d3c5314eb04ef9de857a8f3b67a8149f4e735f.png)

![components](https://scrm0.cdn.banchengyun.com/material/a9f66916248dc1498c0761000f3f45ea734772f3.png)

下载完后打开对应版本的模拟器，调试发现以下错误：

![errorText](https://scrm0.cdn.banchengyun.com/material/c781743148eceb222b4b7ccae163303ba42d94d4.png)

字面意思就是尝试对一个只读属性赋值。

TrackJS 指出，这个报错是一个 ios 中 webkit 内核的 bug（而且每个框架都以独特的方式遇到这个问题.）

[WebIDL attributes should be implemented as getters and setters on the prototype object.](https://bugs.webkit.org/show_bug.cgi?id=49739)

找了一圈，最后在 tarojs 的源码看到了这一句

```javascript
@tarojs/taro-h5/src/api/utils/
```

![errorCode](https://scrm0.cdn.banchengyun.com/material/20c08ba3037d3176c657888560a7eb7f438750c5.png)

这个函数是 taro 中的 Toast，Modal，Loading 等所有携带蒙版组件的注销方法。项目中到处都有用到，坑是真坑啊！！！！！！

早在 18 年的时候就有人向 Taro 开发团队反馈了这个问题，但是： ![stickerTwo](https://scrm0.cdn.banchengyun.com/material/3ae9b98fce6f8c570ed075cd72d28c36814994ec.png)

说说几个解决方法：

1. 判断用户的 ios 版本，如果在 11 以下，则绕过所有带蒙版的组件的渲染，关闭那 2%用户的体验，换取 bug 的修复。
2. 给 taro 官方对应的版本提 issue，等待修复。就等到一千年以后。
3. 将当前 tarojs 源码复制出来，修改后发布到自己的仓库，后期项目开发依赖这个版本，还可以魔改 taro。
