描述
该应用程序仅在 iOS 11.2 上崩溃,unhandled JS Exception: Invalid regular expression: unrecognized character after (?
而不是在调试模式下。我已经在 iOS 13 上测试了相同的代码,它运行良好。我最终弄清楚了哪个正则表达式导致了问题,我发现所有这种类型的正则表达式 (?<value>\d{2}\/\d{2}\/\d{4})
都导致了崩溃,它们作为 Javascript 对象的值存储在一个单独的 .js 文件中。我要求一种不需要更改所有正则表达式的解决方案。
我不明白为什么 iOS 13 上的行为与 iOS 11.2 不同。
此外,我在此链接Crash if not in debug on android and iOS 上发现了与lookbehind regex 类似的问题。
我已经尝试过的
- 首先我尝试将 React Native 更新到最新版本 0.61.5,但它并没有解决我的问题
- 我试图在一个全新的项目中复制同样的问题,但它没有崩溃
- 尝试删除所有正则表达式,这有效,但正则表达式是应用程序重要功能的一部分
环境
System:
OS: macOS 10.15.2
CPU: (8) x64 Intel(R) Core(TM) i7-8559U CPU @ 2.70GHz
Memory: 461.18 MB / 16.00 GB
Binaries:
Node: 13.3.0 - /usr/local/Cellar/node/13.3.0/bin/node
Yarn: 1.19.2 - /usr/local/bin/yarn
npm: 6.13.4 - /usr/local/bin/npm
Watchman: 4.9.0 - /usr/local/bin/watchman
SDKs:
iOS SDK:
Platforms: iOS 13.2, DriverKit 19.0, macOS 10.15, tvOS 13.2, watchOS 6.1
Android SDK:
API Levels: 28, 29
Build Tools: 28.0.3, 29.0.2
System Images: android-29 | Google APIs Intel x86 Atom, android-29 | Google Play Intel x86 Atom
IDEs:
Android Studio: 3.5 AI-191.8026.42.35.5977832
Xcode: 11.3/11C29 - /usr/bin/xcodebuild
npmPackages:
react: 16.8.6 => 16.8.6
react-native: ^0.60.5 => 0.60.5
npmGlobalPackages:
react-native-cli: 2.0.1
截图
谢谢阅读