当我运行一个react-native项目时,我得到一个错误,没有bundle URL,但我不知道我做了什么错误,我很困惑。


当前回答

试着运行这段代码:

$ sudo xcodebuild -license

这可能会解决问题。这对我很有用。

其他回答

我也有同样的错误,只能通过Xcode运行应用程序。React-native run-ios不起作用。要解决这个问题,你需要删除YOUR_PROJECT/ios/build/的build文件夹。在此之后,您应该能够再次通过react-native run-ios运行您的应用程序。希望这能有所帮助。

我不得不在一个单独的终端上运行“react-native start”。由于某种原因,它不运行了

编辑:另外,这是必要的,因为文件权限设置不正确。我能够通过在受影响的项目目录中运行以下命令来修复它。

chmod 777 node_modules/react-native/scripts/ launchpacker .command

试着加上这句话:

<key>NSAppTransportSecurity</key>
<dict>
    <key>NSAllowsArbitraryLoads</key>
    <true/>
    <key>NSAllowsArbitraryLoadsInWebContent</key>
    <true/>
    <key>NSAllowsLocalNetworking</key>
    <true/>
</dict>

是什么帮我解决了这个问题:

打开终端窗口 cd到YOUR_PROJECT/ios 使用rm -r build删除build文件夹 再次运行react-native Run -ios

或者,你可以打开Finder,导航到YOUR_PROJECT/ios并删除构建文件夹。

然后再次运行react-native run-ios。

资料来源:Andrew Bancroft

以下步骤:

用xcode打开ios文件项目 在项目包中删除main。jsbundle文件 通过main添加新的空文件。jsbundle名字 运行comment: react-native bundle——entry-file index.js——platform ios——dev false——bundle-output ios/main。Jsbundle——assets-dest ios 现在是react-native run-ios

youtube链接:https://www.youtube.com/watch?v=eCs2GsWNkoo