从0.60.4升级到0.62.2后的iOS Build Crash

时间:2020-04-22 15:02:13

标签: ios xcode facebook react-native build

我最近将本机项目从0.60.4升级到0.62.2。我添加了所有依赖关系,并一一解决了在终端中引发的所有错误,并且我能够成功编译该项目。现在,当我在XCode中运行构建时,应用程序崩溃并在XCode中输入以下日志:

2020-04-16 16:25:50.635 [error][tid:com.facebook.react.JavaScript] TypeError: undefined is not an object (evaluating 'R.ART.Shape')
2020-04-16 16:25:50.641 [fatal][tid:com.facebook.react.ExceptionsManagerQueue] Unhandled JS Exception: TypeError: undefined is not an object (evaluating 'R.ART.Shape')
2020-04-16 16:25:50.642 [error][tid:com.facebook.react.JavaScript] Invariant Violation: Module AppRegistry is not a registered callable module (calling runApplication)
2020-04-16 16:25:50.686677+0530 MY_APP[14817:106507] *** Terminating app due to uncaught exception 'RCTFatalException: Unhandled JS Exception: TypeError: undefined is not an object (evaluating 'R.ART.Shape')', reason: 'Unhandled JS Exception: TypeError: undefined is not an object (evaluating 'R.ART.Shape'), stack:
<unknown>@875:258
v@2:1473
<unknown>@874:228
v@2:1473
<unknown>@873:242
v@2:1473
<unknown>@872:150
v@2:1473
<unknown>@870:228
v@2:1473
<unknown>@868:342
v@2:1473
<unknown>@394:471
v@2:1473
<unknown>@6:70
v@2:1473
d@2:875
global code@1220:3
'
*** First throw call stack:
(
    0   CoreFoundation                      0x000000010c4601bb __exceptionPreprocess + 331
    1   libobjc.A.dylib                     0x000000010a846735 objc_exception_throw + 48
    2   MY_APP                                0x0000000106f0426a RCTFormatError + 0
    3   MY_APP                                0x0000000106f876fc -[RCTExceptionsManager reportFatal:stack:exceptionId:suppressRedBox:] + 519
    4   MY_APP                                0x0000000106f88197 -[RCTExceptionsManager reportException:] + 1669
    5   CoreFoundation                      0x000000010c46703c __invoking___ + 140
    6   CoreFoundation                      0x000000010c4644d5 -[NSInvocation invoke] + 325
    7   CoreFoundation                      0x000000010c464926 -[NSInvocation invokeWithTarget:] + 54
    8   MY_APP                                0x0000000106f36c51 -[RCTModuleMethod invokeWithBridge:module:arguments:] + 612
    9   MY_APP                                0x0000000106f39203 _ZN8facebook5reactL11invokeInnerEP9RCTBridgeP13RCTModuleDatajRKN5folly7dynamicE + 251
    10  MY_APP                                0x0000000106f38f85 ___ZN8facebook5react15RCTNativeModule6invokeEjON5folly7dynamicEi_block_invoke + 78
    11  libdispatch.dylib                   0x000000010e367595 _dispatch_call_block_and_release + 12
    12  libdispatch.dylib                   0x000000010e368602 _dispatch_client_callout + 8
    13  libdispatch.dylib                   0x000000010e36fb0b _dispatch_lane_serial_drain + 791
    14  libdispatch.dylib                   0x000000010e370784 _dispatch_lane_invoke + 428
    15  libdispatch.dylib                   0x000000010e37a89a _dispatch_workloop_worker_thread + 733
    16  libsystem_pthread.dylib             0x000000010e6fd611 _pthread_wqthread + 421
    17  libsystem_pthread.dylib             0x000000010e6fd3fd start_wqthread + 13
)
libc++abi.dylib: terminating with uncaught exception of type NSException

本机信息

System:
    OS: macOS Mojave 10.14.6
    CPU: (4) x64 Intel(R) Core(TM) i5-5250U CPU @ 1.60GHz
    Memory: 317.59 MB / 8.00 GB
    Shell: 5.3 - /bin/zsh
  Binaries:
    Node: 13.13.0 - /usr/local/bin/node
    Yarn: Not Found
    npm: 6.14.4 - /usr/local/bin/npm
    Watchman: 4.9.0 - /usr/local/bin/watchman
  Managers:
    CocoaPods: 1.7.5 - /usr/local/bin/pod
  SDKs:
    iOS SDK:
      Platforms: iOS 12.1, macOS 10.14, tvOS 12.1, watchOS 5.1
    Android SDK:
      API Levels: 23, 24, 26, 28
      Build Tools: 28.0.3
      System Images: android-28 | Google Play Intel x86 Atom
      Android NDK: Not Found
  IDEs:
    Android Studio: Not Found
    Xcode: 10.1/10B61 - /usr/bin/xcodebuild
  Languages:
    Java: 1.8.0_73 - /usr/bin/javac
    Python: 2.7.10 - /usr/bin/python
  npmPackages:
    @react-native-community/cli: Not Found
    react: 16.11.0 => 16.11.0 
    react-native: 0.62.2 => 0.62.2 
  npmGlobalPackages:
    *react-native*: Not Found

任何帮助将不胜感激。 提前感谢。

1 个答案:

答案 0 :(得分:0)

经过大量的调试过程终于得到了解决方案。

实际上,在该项目中,有一个npm包react-native-pie-chart,它具有ART的对等依赖关系,但是由于ART现在已从react-native包中删除,因此失败了。 ART现在可以作为独立的软件包“ @ react-native-community / art”使用。

因此,我删除了react-native-pie-chart程序包,并使用https://github.com/sarmad1995/react-native-pie-chart进行了添加,因为原始的react-native-pie-chart程序包尚未更新,并且仍使用来自react-native的ART。 >