React Native“无法连接到开发服务器". [英] React Native "Could not connect to development server."

查看:264
本文介绍了React Native“无法连接到开发服务器".的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我知道这个问题已经被问过几次了,但是没有解决方案对我有用.实际上,有时它确实可以连接并且我的应用程序在设备上运行,但是一两次尝试之后,却没有任何变化,但是突然没有.我的应用程序始终在模拟器中运行.

I know this already has been asked a few times, but no solution has worked for me. In fact, sometimes it does connect and my app runs on the device, but one or two attempts later, with no change, it suddenly does not. My app always runs in the emulator.

我已经在AppDelegate.m和RCTWebsocketExecutor.m中设置了IP.我已经将应用程序传输安全设置"设置为允许任意负载",甚至将其设置为允许我的IP.我的应用程序正在使用 react-native-storage 来存储用户,不确定是否在测试时可能会引起任何问题.

I've set my IP in AppDelegate.m and RCTWebsocketExecutor.m. I've set App Transport Security Settings to "Allow Arbitrary Loads" and even set it to allow my IP. My app is using the react-native-storage to store a user, not sure if that could cause any problems while testing.

推荐答案

我知道了.这是一个网络问题.我用 ngrok 解决了我的问题.

I figured it out. It was a network problem. I used ngrok to solve my problem.

这篇关于React Native“无法连接到开发服务器".的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆