react native 0.52.0 真机远程调测JS方法

当初开发APP使用的是0.52.0这个版本

后台需要真机远程调测JS,根据官方文档:https://facebook.github.io/react-native/docs/0.52/running-on-device.html

无需配置,只需要在同wifi下,将debug版本的通过XCODE安装在手机中,摇动手机弹出开发选项,选择“remote js DEbugging”即可,但实际中手机一直显示

clipboard.png

谷歌浏览器包跨域错误

clipboard.png

Failed to load http://192.168.43.170.xip.io:8081/index.delta?platform=ios&dev=true&minify=false: No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://localhost:8081' is therefore not allowed access. If an opaque response serves your needs, set the request's mode to 'no-cors' to fetch the resource with CORS disabled.

错误是关于跨域和cors的错误。搞了好久都解决不了。

后来自己测试其他版本0.51.0和最新的0.55版本都可以,不会报错。

最后看了下官方的更新日志。。。。。。F.......k




issue如下:https://github.com/facebook/react-native/commit/df8da3b


下载地址:https://pan.baidu.com/s/1Kmeue9BWdYfgHzM9GXAcgg

替换项目中/node_modules/react-native/local-cli/server/middleware对应文件即可,亲测!


猜你喜欢

转载自blog.csdn.net/ky1in93/article/details/80568217
今日推荐