[英]Getting error while running clubbed swift & react-native project on iOS device
I have an existing project written on swift and I have integrated react native to it everything is working fine on simulator but while running on device it give an error ie- 我有一个用swift编写的现有项目,并且已经集成了本机响应功能,它在模拟器上一切正常,但是在设备上运行时却出现错误,即-
Could not connect to the development server. 无法连接到开发服务器。 Ensure 确保
I have tried most of the method discuss over here github link 我已经尝试了这里讨论的大多数方法github链接
but still i could not able to solve it, if i am missing any things kindly enlighten on comment or answer you valuable time will always be helpful 但是我仍然无法解决问题,如果我错过了任何事情,请在评论或回答您时给予宝贵的时间,将总是有帮助的
thank you 谢谢
Note:- Only for project which uses both swift code and react-native code 注意:-仅适用于同时使用快速代码和react-native代码的项目
Xcode 8x swift 3x Xcode 8x快速3x
As a clubbed project which consists of swift and react-native follow the step to run it on the device:- 作为由快速反应和本机反应组成的俱乐部项目,请按照以下步骤在设备上运行它:-
In place of 代替
Type a script or drag a script file from your workspace to insert its path
place this 放置这个
export NODE_BINARY=node /{your project directory }/js/node_modules/react-native/packager/react-native-xcode.sh
from this 由此
return URL(string:" http://localhost:8081/index.ios.bundle?platform=ios ") 返回网址(字符串:“ http:// localhost:8081 / index.ios.bundle?platform = ios “)
to this 对此
this - return Bundle.main.url(forResource: "main", withExtension: "jsbundle") 这-返回Bundle.main.url(forResource:“ main”,withExtension:“ jsbundle”)
when you will run the project it will generate an offline .js bundle and fetch all data from that 当您运行项目时,它将生成一个脱机.js软件包并从中获取所有数据
while running the project make sure you watch the report navigator check if script run successfully or not like the image below 在运行项目时,请确保您观看报告导航器,以检查脚本是否成功运行,如下图所示
if everything is ok it will run on the device as well as simulator 如果一切正常,它将在设备以及模拟器上运行
resource used from solving raywenderlich.com 解决raywenderlich.com使用的资源
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.