2018-07-31 RN 0.52.0以后版本不能使用chro
RN0.52版本后,开启remote debug后, chrome会显示报错,类似
Failed to load http://192.168.0.105: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.
或者
Failed to load http://localhost:8081/index.delta?platform=ios&dev=true&minify=false: No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://192.168.0.105: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.
,程序不能正常运行!
解决方法是,安装chrome插件“Allow-Control-Allow-Origin”,之后就正常了,吼吼!
参考文献:
Remote debug CORS issue · Issue #18006 · facebook/react-native · GitHub