IOS release build crash: TypeError: n.render is not a function。 (在 'n.render()' 中,'n.render' 未定义) Re

Posted

技术标签:

【中文标题】IOS release build crash: TypeError: n.render is not a function。 (在 \'n.render()\' 中,\'n.render\' 未定义) React Native 0.56【英文标题】:IOS release build crashes: TypeError: n.render is not a function. (In 'n.render()', 'n.render' is undefined) React Native 0.56IOS release build crash: TypeError: n.render is not a function。 (在 'n.render()' 中,'n.render' 未定义) React Native 0.56 【发布时间】:2019-05-01 01:53:08 【问题描述】:

我最近升级到 react native 0.56 。我遇到了很多错误,但我已经修复了大部分。但是现在当我尝试在发布模式下运行应用程序时,我得到了这个 js 错误。

2019-05-01 11:45:00.625 [fatal][tid:com.facebook.react.ExceptionsManagerQueue] Unhandled JS Exception: TypeError: n.render is not a function. (In 'n.render()', 'n.render' is undefined)

This error is located at:
    in n
dyld_image_header_containing_address(0x10ba6d27d)
dladdr(0x10fcc329b, 0x7f823a8ad560)
dladdr(0x10da4f735, 0x7f823a8ad580)
dladdr(0x10ba3d6b2, 0x7f823a8ad5a0)
dladdr(0x10ba3a40c, 0x7f823a8ad5c0)
dladdr(0x10fcca11c, 0x7f823a8ad5e0)
dladdr(0x10fcc75b5, 0x7f823a8ad600)
dladdr(0x10fcc7a06, 0x7f823a8ad620)
dladdr(0x10ba50cde, 0x7f823a8ad640)
dladdr(0x10ba96a95, 0x7f823a8ad660)
dladdr(0x10ba96813, 0x7f823a8ad680)
dladdr(0x111f655d1, 0x7f823a8ad6a0)
dladdr(0x111f6663e, 0x7f823a8ad6c0)
dladdr(0x111f6db47, 0x7f823a8ad6e0)
dladdr(0x111f6e7c0, 0x7f823a8ad700)
dladdr(0x111f788b8, 0x7f823a8ad720)
dladdr(0x11231563c, 0x7f823a8ad740)
dladdr(0x112315435, 0x7f823a8ad760)
dlsym_internal(0x7f823a875030, _FSURLBeginResourcePropertyCacheAccess)
  dlsym_internal(0x7f823a875030, _FSURLBeginResourcePropertyCacheAccess) ==> 0x13223940a
dlsym_internal(0x7f823a875030, _FSURLSetResourcePropertyForKey)
  dlsym_internal(0x7f823a875030, _FSURLSetResourcePropertyForKey) ==> 0x132236e00
dlsym_internal(0x7f823a875030, _FSURLEndResourcePropertyCacheAccess)
  dlsym_internal(0x7f823a875030, _FSURLEndResourcePropertyCacheAccess) ==> 0x132239517
dyld_image_header_containing_address(0x10b9be832)
dyld_image_header_containing_address(0x10fcc3801)
libc++abi.dylib: terminating with uncaught exception of type NSException

通过 react-native run-ios --configuration Release 和 Xcode(使用 Release 配置)构建时都会发生这种情况。调试工作正常。

反应原生版本:0.56 反应版本:16.4.1 Xcode 10.1 版

【问题讨论】:

【参考方案1】:

没关系。我通过修复我的删除 babel.config.js 并将我的 .babelrc 文件修复到

来解决它

  "env": 
    "development": 
      "presets": ["react-native", "@babel/preset-flow"],
      "plugins": [
        ["@babel/plugin-proposal-decorators",  "legacy": true ],
        [
          "@babel/plugin-transform-runtime",
          
            "helpers": true,
            "regenerator": false
          
        ]
      ]
    ,
    "production": 
      "presets": ["react-native", "@babel/preset-flow"],
      "plugins": [
        ["@babel/plugin-proposal-decorators",  "legacy": true ],
        "transform-remove-console"
      ]
    
  

【讨论】:

以上是关于IOS release build crash: TypeError: n.render is not a function。 (在 'n.render()' 中,'n.render' 未定义) Re的主要内容,如果未能解决你的问题,请参考以下文章

iOS通过dSYM文件分析crash

存档成功,但导出失败:cordova build ios --release

ionic build ios --release build 失败导致错误代码 65

运行 ionic ios build --prod --release 时出错

运行cordova build ios --release(退出代码1)时发生错误[关闭]

Flutter ios release build 找不到快照