美文网首页
React-Native 运行报 Could not conne

React-Native 运行报 Could not conne

作者: 清风沐沐 | 来源:发表于2016-10-26 11:28 被阅读64次

解决方法:

AppDelegate.m文件中,把一下代码中的localhost
改为你电脑的IP地址,并且保证你的真机连接的是同一个网络(例如:连接同一个路由的网络)。

  • 在mac终端中使用命令:ifconfig 可以查看本机IP

  • 原:
    jsCodeLocation = [NSURL URLWithString:@"http://localhost:8081/index.ios.bundle?platform=ios&dev=true"];

  • 修改为
    jsCodeLocation = [NSURL URLWithString:@"http://你的mac的IP:8081/index.ios.bundle?platform=ios&dev=true"];

  • 例如:
    jsCodeLocation = [NSURL URLWithString:@"http://192.168.0.54:8081/index.ios.bundle?platform=ios&dev=true"];

相关文章

网友评论

      本文标题:React-Native 运行报 Could not conne

      本文链接:https://www.haomeiwen.com/subject/mvpduttx.html