将 Expo SDK 更新到版本 49 后,如何调试 iOS 上的 React Native Expo 应用程序崩溃。在 iOS 模拟器中运行该应用程序工作正常

Zet*_*eth 6 xcode ios react-native expo

我有一个使用 React Native 和 Expo 构建的应用程序。\n我在 Expo SDK 版本 48 上使用它,刚刚升级到版本 49。现在,当我运行:eas build然后eas submit通过手机上的 TestFlight 更新我的应用程序时,它会立即崩溃。

\n

我该如何解决这个错误 - 或者找出它发生的原因?
\n仅供参考:我的项目名称是hercules.

\n

解决方案尝试 1:App Store Connect 崩溃报告

\n

然后我可以发送崩溃报告。

\n

如果我在 App Store Connect 中找到它并单击“在 Xcode 中打开”:

\n

试飞事故反馈

\n

然后我得到这样的堆栈跟踪:

\n

ios 堆栈跟踪

\n

我想这就是使用 React Native 和 Expo 的缺点。当像这样生成最终构建时,就很难理解堆栈跟踪。我无法理解上图中的内容。

\n

解决方案尝试 2:在 Expo.dev 中构建日志

\n

我还从 Expo.dev“构建”菜单中检查了“构建日志”。有 9mb 的日志。这是开始和结束(没有时间戳,所以我不知道它是按升序还是降序排序):

\n
Command line invocation:\n    /Applications/Xcode.app/Contents/Developer/usr/bin/xcodebuild -workspace ./hercules.xcworkspace -scheme hercules -configuration Release -destination generic/platform=iOS -archivePath "/Users/expo/Library/Developer/Xcode/Archives/2023-07-09/hercules 2023-07-09 15.19.05.xcarchive" archive\nUser defaults from command line:\n    IDEArchivePathOverride = /Users/expo/Library/Developer/Xcode/Archives/2023-07-09/hercules 2023-07-09 15.19.05.xcarchive\n    IDEPackageSupportUseBuiltinSCM = YES\nPrepare packages\nComputing target dependency graph and provisioning inputs\nCreate build description\nBuild description signature: 2d65783870e59f558d579d6dedae71da\nBuild description path: /Users/expo/Library/Developer/Xcode/DerivedData/hercules-aiqjbxmtddzpiscjqedlczrddaee/Build/Intermediates.noindex/ArchiveIntermediates/hercules/IntermediateBuildFilesPath/XCBuildData/2d65783870e59f558d579d6dedae71da.xcbuilddata\nnote: Building targets in dependency order\nCreateBuildDirectory /Users/expo/Library/Developer/Xcode/DerivedData/hercules-aiqjbxmtddzpiscjqedlczrddaee/Build/Intermediates.noindex/ArchiveIntermediates/hercules/InstallationBuildProductsLocation\n    cd /Users/expo/workingdir/build/ios\n    builtin-create-build-directory /Users/expo/Library/Developer/Xcode/DerivedData/hercules-aiqjbxmtddzpiscjqedlczrddaee/Build/Intermediates.noindex/ArchiveIntermediates/hercules/InstallationBuildProductsLocation\nCreateBuildDirectory /Users/expo/Library/Developer/Xcode/DerivedData/hercules-aiqjbxmtddzpiscjqedlczrddaee/Build/Intermediates.noindex/ArchiveIntermediates/hercules/IntermediateBuildFilesPath\n...\n...\n...\nValidate /Users/expo/Library/Developer/Xcode/DerivedData/hercules-aiqjbxmtddzpiscjqedlczrddaee/Build/Intermediates.noindex/ArchiveIntermediates/hercules/InstallationBuildProductsLocation/Applications/hercules.app (in target \'hercules\' from project \'hercules\')\n    cd /Users/expo/workingdir/build/ios\n    builtin-validationUtility /Users/expo/Library/Developer/Xcode/DerivedData/hercules-aiqjbxmtddzpiscjqedlczrddaee/Build/Intermediates.noindex/ArchiveIntermediates/hercules/InstallationBuildProductsLocation/Applications/hercules.app\nTouch /Users/expo/Library/Developer/Xcode/DerivedData/hercules-aiqjbxmtddzpiscjqedlczrddaee/Build/Intermediates.noindex/ArchiveIntermediates/hercules/InstallationBuildProductsLocation/Applications/hercules.app (in target \'hercules\' from project \'hercules\')\n    cd /Users/expo/workingdir/build/ios\n    /usr/bin/touch -c /Users/expo/Library/Developer/Xcode/DerivedData/hercules-aiqjbxmtddzpiscjqedlczrddaee/Build/Intermediates.noindex/ArchiveIntermediates/hercules/InstallationBuildProductsLocation/Applications/hercules.app\nwarning: Run script build phase \'[CP-User] Generate app.manifest for expo-updates\' will be run during every build because it does not specify any outputs. To address this warning, either add output dependencies to the script phase, or configure it to run in every build by unchecking "Based on dependency analysis" in the script phase. (in target \'EXUpdates\' from project \'Pods\')\n** ARCHIVE SUCCEEDED **\n
Run Code Online (Sandbox Code Playgroud)\n

解决方案尝试3:其他小注释和尝试

\n
    \n
  • 在我的手机上,更新应用程序版本后,我没有看到任何内容:它立即崩溃了。
  • \n
  • 我尝试强制退出该应用程序,重新安装它,重新启动手机。这些都不会改变结果(仍然是立即崩溃)。
  • \n
  • 可以在 Mac 上的 iOS 模拟器中运行该应用程序(没有崩溃,但我确实遇到了 Axios 网络错误,我正在调试)。
  • \n
  • 我尝试安装 Sentry以获得更好的错误报告。但我无法让它工作(构建开始失败)。所以我再次删除这个。
  • \n
\n
\n

快速修复:降级到 Expo 版本48.0.18

\n

我降级了版本package.json(其中清理了被升级的新版本中的文件)。\n然后我删除了package-lock.jsonnode_modules
\n然npm install
\n然npx expo install --fix
\n然npx expo start -c
\n然eas build
\n然eas submit

\n

那行得通。没有崩溃。\xc2\xaf\\_(\xe3\x83\x84)_/\xc2\xaf

\n

Tay*_*ill 3

经过一天的努力,我在构建中修复了这个问题:这个问题实际上并不是由世博会引起的;它是由世博会引起的。它是由 的过时版本引起的expo-jest,该版本失败是因为它引用了 的过时版本expo-config。我最初在 expo-doctor 中忽略了它,因为它只是一个开发依赖项,所以我认为这并不重要。

您可以通过运行npx expo-doctor并查看它是否提到有关 的内容来验证这是否是您的问题expo-config。为了升级到 expo 49,我只是将"jest-expo"package.json 中的行替换为"jest-expo": "^49.0.0".