[英]Bundlejs error on release build in Xcode (react-native)
For some reason I am getting the following error when building a release version of my application via react-native. 出于某种原因,通过react-native构建应用程序的发行版时,出现以下错误。
*** Terminating app due to uncaught exception 'RCTFatalException: Unhandled JS Exception: t.typeof is not a function.
***由于未捕获的异常'RCTFatalException:未处理的JS异常:t.typeof不是函数,因此终止了应用程序。 (In 't.typeof("function"==typeof Symbol?Symbol.iterator:"@@iterator")', 't.typeof' is undefined) (/Users/../THEAPP.app/main.jsbundle:11)', reason: 'Unhandled JS Exception: t.typeof is not a function.
(在't.typeof(“ function” == typeof Symbol?Symbol.iterator:“ @@ iterator”)'中,'t.typeof'未定义)(/ Users /../ THEAPP.app/main.jsbundle: 11)”,原因:“未处理的JS异常:t.typeof不是函数。 (In 't.typeof("function...'
(在't.typeof(“ function ...”
This is the source of the code that has the above error that I found in my bundlejs file: 这是在我的bundlejs文件中发现上述错误的代码源:
!(function(e){"use strict";var r,t=e.babelHelpers={};t.typeof="function"==typeof Symbol&&"symbol"===t.typeof("function"==typeof Symbol?Symbol.iterator:"@@iterator")?
I have tried both of these methods of a release build: 我已经尝试了发布构建的这两种方法:
react-native bundle --entry-file index.js --platform ios --dev false --bundle-output ios/main.jsbundle --assets-dest ios
react-native bundle --entry-file index.js --platform ios --dev false --bundle-output ios/main.jsbundle --assets-dest ios
I get the same error for both of these. 对于这两个我都得到相同的错误。 And of course, this is after I change my AppDelegate.m to the following:
当然,这是在将AppDelegate.m更改为以下代码之后:
//jsCodeLocation = [[RCTBundleURLProvider sharedSettings] jsBundleURLForBundleRoot:@"index" fallbackResource:nil];
jsCodeLocation = [[NSBundle mainBundle] URLForResource:@"main" withExtension:@"jsbundle"];
I also followed someone's response from Github issues and tried the following, but got another separate issue entirely after the fact: 我还跟踪了某人对 Github问题的回答 ,并尝试了以下方法,但事后完全又遇到了另一个问题:
I did: 我做了:
npm uninstall -g babel-preset-env
npm install --save @babel/preset-env
Added this to my package.json file 将此添加到我的package.json文件中
"babel": { "presets": ["@babel/preset-env", "react-native"] }
And created a .babelrc
file in my root project with: 并在我的根项目中创建一个
.babelrc
文件,其内容如下:
{ "presets": ["@babel/preset-env", "react-native"] }
Then get this on an Xcode build: 然后在Xcode构建上获取此代码:
我通过完全重启我的应用程序并使用以下方法解决了这个问题:
react-native init PROJECTNAME
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.