3

我升级到 React Native v0.37。iOS 模拟器工作正常,但尝试在设备上运行应用程序时出现错误:

[fatal][tid:main] No script URL provided. Make sure the packager is running or you have embedded a JS bundle in your application bundle.unsanitizedScriptURLString:((null))

有谁知道为什么?

非常感谢您的帮助。

4

2 回答 2

1

确保您在 Info.plist 中允许 localhost

<key>NSAppTransportSecurity</key>
<dict>
    <key>NSExceptionDomains</key>
    <dict>
        <key>localhost</key>
        <dict>
            <key>NSIncludesSubdomains</key>
            <true/>
            <key>NSTemporaryExceptionAllowsInsecureHTTPLoads</key>
            <true/>
        </dict>
    </dict>
</dict>
于 2016-11-22T11:57:49.453 回答
1

好的,所以在升级到 React Native 0.38 后我又遇到了这个问题。

我运行“react-native bundle --dev false --assets-dest ./ios --entry-file index.ios.js --platform ios --bundle-output ios/main.jsbundle”在一个干净的方式,并发现存在由 Babel 插件配置问题引起的错误。清理我的 .babelrc 文件后,打包运行良好。然后它会生成 main.jsbundle,你必须将它添加到 xcode 中的项目中。之后编译运行良好。

于 2016-11-26T10:29:47.873 回答