React Native 应用程序在启动画面后立即在Testflight中崩溃,但在Expo中未崩溃

irlmq6kh  于 2023-01-31  发布在  React
关注(0)|答案(1)|浏览(179)

在使用EAS从Expo SDK 44(expo build)升级到SDK 47后,我无法让应用在Testflight中运行。到目前为止,我让应用在Expo中运行。但当我使用EAS构建并尝试运行它时,它在启动画面后崩溃。
崩溃日志提到EXUpdatesErrorRecovery. m,但到目前为止在互联网上搜索只了解到我可以是任何东西。

跟踪

Exception Type:  EXC_CRASH (SIGABRT)
Exception Codes: 0x0000000000000000, 0x0000000000000000
Triggered by Thread:  2

Last Exception Backtrace:
0   CoreFoundation                  0x18da4de88 __exceptionPreprocess + 164 (NSException.m:202)
1   libobjc.A.dylib                 0x186d838d8 objc_exception_throw + 60 (objc-exception.mm:356)
2   MetarTaf                        0x102d8b3bc -[EXUpdatesAppController throwException:] + 24 (EXUpdatesAppController.m:485)
3   MetarTaf                        0x102d9cbd8 -[EXUpdatesErrorRecovery _crash] + 768 (EXUpdatesErrorRecovery.m:268)
4   MetarTaf                        0x102d9c420 -[EXUpdatesErrorRecovery _runNextTask] + 200 (EXUpdatesErrorRecovery.m:184)
5   libdispatch.dylib               0x19501c4b4 _dispatch_call_block_and_release + 32 (init.c:1518)
6   libdispatch.dylib               0x19501dfdc _dispatch_client_callout + 20 (object.m:560)
7   libdispatch.dylib               0x195025694 _dispatch_lane_serial_drain + 672 (inline_internal.h:2632)
8   libdispatch.dylib               0x1950261e0 _dispatch_lane_invoke + 384 (queue.c:3940)
9   libdispatch.dylib               0x195030e10 _dispatch_workloop_worker_thread + 652 (queue.c:6846)
10  libsystem_pthread.dylib         0x1daaa3df8 _pthread_wqthread + 288 (pthread.c:2618)
11  libsystem_pthread.dylib         0x1daaa3b98 start_wqthread + 8 (:-1)

使用的硬件(iPhone 13)

Incident Identifier: A562E67E-ABF6-4196-B5DD-ACED79363679
Hardware Model:      iPhone14,5
Process:             -- [16963]
Path:                --
Identifier:          --
Version:             2.4.0 (2.4.5)
AppStoreTools:       14C17
AppVariant:          1:iPhone14,5:16
Beta:                YES
Code Type:           ARM-64 (Native)
Role:                Foreground
Parent Process:      launchd [1]
Coalition:           -- [2764]

Date/Time:           2023-01-28 11:53:14.2711 +0100
Launch Time:         2023-01-28 11:53:13.6737 +0100
OS Version:          iPhone OS 16.1.1 (20B101)
Release Type:        User
Baseband Version:    2.12.02
Report Version:      104

程序包. json

..   "dependencies": {
    "@react-native-async-storage/async-storage": "~1.17.3",
    "@react-native-clipboard/clipboard": "^1.11.1",
    "@react-navigation/material-bottom-tabs": "^6.2.11",
    "@react-navigation/material-top-tabs": "^6.5.2",
    "@react-navigation/native-stack": "^6.9.8",
    "deprecated-react-native-prop-types": "^4.0.0",
    "expo": "^47.0.0",
    "expo-application": "~5.0.1",
    "expo-constants": "~14.0.2",
    "expo-device": "~5.0.0",
    "expo-file-system": "~15.1.1",
    "expo-font": "~11.0.1",
    "expo-linking": "~3.3.0",
    "expo-localization": "~14.0.0",
    "expo-location": "~15.0.1",
    "expo-notifications": "~0.17.0",
    "expo-speech": "~11.0.0",
    "expo-status-bar": "~1.4.2",
    "expo-store-review": "~6.0.0",
    "expo-system-ui": "~2.0.1",
    "expo-updates": "~0.15.6",
    "react": "18.1.0",
    "react-dom": "18.1.0",
    "react-native": "0.70.5",
    "react-native-elements": "^3.4.3",
    "react-native-gesture-handler": "~2.8.0",
    "react-native-pager-view": "6.0.1",
    "react-native-paper": "^4.12.5",
    "react-native-popup-menu": "^0.15.13",
    "react-native-root-toast": "^3.3.1",
    "react-native-safe-area-context": "4.4.1",
    "react-native-screens": "~3.18.0",
    "react-native-stack": "^1.0.0-alpha11",
    "react-native-svg": "13.4.0",
    "react-native-swipeable": "^0.6.0",
    "react-native-tab-view": "^3.3.4",
    "react-native-vector-icons": "^9.2.0",
    "react-native-web": "~0.18.7",
    "react-native-webview": "11.23.1",
    "react-navigation": "^4.4.4"   },   "devDependencies": {
    "@babel/core": "^7.19.3",
    "typescript": "^4.6.3"   },  ..

更新:
当崩溃发生时,我在XCode控制台中发现了一些错误,我已经在本地环境中解决了这些错误。为此,我必须按照下面列出的说明,破解node_modules以获得react-native-swipeable和react-native本身:Invariant Violation: ViewPropTypes has been removed from React Native. Migrate to ViewPropTypes exported from 'deprecated-react-native-prop-types'

Invariant Violation: ViewPropTypes has been removed from React Native. Migrate to ViewPropTypes exported from 'deprecated-react-native-prop-types'.
Unhandled JS Exception: Invariant Violation: ViewPropTypes has been removed from React Native. Migrate to ViewPropTypes exported from 'deprecated-react-native-prop-types'.
..
Invariant Violation: Failed to call into JavaScript module method AppRegistry.runApplication(). Module has not been registered as callable. Registered callable JavaScript modules (n = 11): Systrace, JSTimers, HeapCapture, SamplingProfiler, RCTLog, RCTDeviceEventEmitter, RCTNativeAppEventEmitter, GlobalPerformanceLogger, JSDevSupportModule, HMRClient, RCTEventEmitter.
A frequent cause of the error is that the application entry file path is incorrect. This can also happen when the JS bundle is corrupt or there is an early initialization error when loading React Native.

EAS似乎正在尝试使用不同的node_modules目录构建应用程序。
希望有人能帮我。

dzhpxtsq

dzhpxtsq1#

EAS维护自己的node_modules副本,因此更改本地node_modules中的脚本对生产构建没有影响。
react-native包(0.70.5)和react-native-swipeable(0.6.0)都没有得到正确维护,在发布时无法正常工作。它们仍然使用已从React Native中删除的ViewPropTypes。解决方法是使用deprecated-react-native-prop-types包。
要使用已弃用的proptypes包,您需要手动更改node_modules,但这些更改不会发送到EAS。
Patch-package通过重放您在服务器端所做的更改来处理这一问题。
根据它的文档,我安装了patch-package(参见https://www.npmjs.com/package/patch-package)。首先在app.json中添加了安装后钩子:

"scripts": {
+  "postinstall": "patch-package"
 }

然后我安装了npm包:

npm i patch-package

接下来我注册了打补丁的包:

npx patch-package react-native
npx patch-package react-native-swipeable

并启动了具有清除缓存的新EAS构建,以确保:

eas build -p ios --clear-cache

您可以检查Expo〉Build Details〉Prebuild以查看是否远程应用了修补程序:

- Config syncing
✔ Config synced
Running "npm install" in the root dir of your repository 
> metartaf@2.4.0 postinstall
> patch-package
patch-package 6.5.1
Applying patches...
react-native@0.70.5 ✔
react-native-swipeable@0.6.0 ✔
added 8 packages, and audited 1331 packages in 2s
83 packages are looking for funding
  run `npm fund` for details
9 high severity vulnerabilities

希望这对任何有同样问题的人有帮助。

相关问题