react-native run-ios启动报错 No bundle URL present Make sure you're running a packager server...解决办法

项目在android环境中运行起来没问题,但是在ios中报错,然后这里找到两种解决办法
react-native run-ios启动报错 No bundle URL present Make sure you're running a packager server...解决办法
方法一:
项目中打开一个终端,运行react-native start启动服务器
再次打开一个终端,运行react-native run-ios

方法二:
删除ios文件夹下面的main.jsbundle文件中的内容
运行react-native bundle --entry-file index.js --platform ios --dev false --bundle-output ios/main.jsbundle --assets-dest ios重新构建bundle,构建成功后运行react-native run-ios