[英]React Native AppDelegate.m has no place to change localhost
I just init-ed a React Native project and want to run on my iOS device, but when I go into Xcode I cannot find where I should set the IP of my dev computer. 我只是初始化一个React Native项目并想在我的iOS设备上运行,但是当我进入Xcode时,我找不到应该在哪里设置我的开发计算机的IP。
[[RCTBundleURLProvider sharedSettings] setDefaults];
jsCodeLocation = [[RCTBundleURLProvider sharedSettings] jsBundleURLForBundleRoot:@"index.ios" fallbackResource:nil];
As of react-native 0.44.0: 从本机0.44.0开始:
You need to create a file with name "ip.txt" and paste you macbook's IP address in a single line without any whitespace. 您需要创建一个名称为“ ip.txt”的文件,并将macbook的IP地址粘贴到没有任何空格的一行中。 Save this file and make sure your macbook and test device are on the same wi-fi.
保存此文件,并确保您的Macbook和测试设备在同一Wi-Fi上。 Whenever you want to fallback to the localhost, remove this file (or remove from your target).
每当您想回退到本地主机时,都请删除此文件(或从目标中删除)。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.