You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

React Native iOS应用指定Debug/Release配置启动时崩溃求助

React Native iOS指定构建配置启动崩溃:double-conversion库缺失问题

问题描述

  • 正常启动场景:使用npx react-native run-ios命令或直接在Xcode中构建运行,应用可正常启动
  • 崩溃场景:使用npx react-native run-ios --configuration=debug或--configuration=release命令时,应用启动立即触发EXC_CRASH (SIGABRT)崩溃
  • 核心崩溃原因:dyld无法找到@rpath/double-conversion.framework/double-conversion库
  • 已尝试无效操作:手动链接libDoubleConversion.a和double-conversion.xcframework

崩溃报告

Exception Type:  EXC_CRASH (SIGABRT)
Exception Codes: 0x0000000000000000, 0x0000000000000000
Exception Note:  EXC_CORPSE_NOTIFY
Termination Reason: DYLD 1 Library missing
Library not loaded: @rpath/double-conversion.framework/double-conversion
Referenced from: <FC807FC8-F29C-3926-8FD2-B52AB0C43805> /Users/USER/Library/Developer/CoreSimulator/Devices/9DC328E5-38CB-4BAE-AA0F-E2976C0765E4/data/Containers/Bundle/Application/EFC99D36-68DA-47EB-A147-602CC1AE1B59/tekvetek_RN.app/tekvetek_RN
Reason: tried: '/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot/usr/lib/swift/double-conversion.framework/double-conversion' (errno=2), '/usr/lib/swift/double-conversion.framework/double-conversion' (errno=2, no dyld cache), '/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot/usr/lib/swift/double-conversion.framework/double-conversion' (errno=2), '/usr/lib/swift/double-conversion.framework/double-conversion' (errno=2, no dyld cache), '/Users/omerkocer/Libra
(terminated at launch; ignore backtrace)

Triggered by Thread:  0

Thread 0 Crashed:
0   ???                                    0x1062d6940 ???
1   <translation info unavailable>         0x1063636fc ???
2   dyld                                   0x206696a72 abort_with_payload_wrapper_internal + 80
3   dyld                                   0x206696aa4 abort_with_payload + 9
4   dyld_sim                               0x10ea79593 abort_with_payload + 26
5   dyld_sim                               0x10ea26f1e dyld4::halt(char const*) + 375
6   dyld_sim                               0x10ea24f75 dyld4::prepare(dyld4::APIs&, dyld3::MachOAnalyzer const*) + 3928
7   dyld_sim                               0x10ea251a0 _dyld_sim_prepare + 442
8   dyld                                   0x206640b78 dyld4::prepareSim(dyld4::RuntimeState&, char const*) + 1265
9   dyld                                   0x20663f70e dyld4::prepare(dyld4::APIs&, dyld3::MachOAnalyzer const*) + 244
10  dyld                                   0x20663f4e4 start + 388

Thread 1:: com.apple.rosetta.exceptionserver
0   ???                                 0x7ff7ffeed944 ???
1   ???                                 0x7ff7fff061f0 ???


Thread 0 crashed with X86 Thread State (64-bit):
  rax: 0x0000000000000006  rbx: 0x000000000000010b  rcx: 0x0000000000000001  rdx: 0x000000030efbe6c0
  rdi: 0x000000200ea28d03  rsi: 0x000000030efbe390  rbp: 0x0000000000000000  rsp: 0x000000030efbe2c0
   r8: 0x000000030efbe2c0   r9: 0x0000000000000000  r10: 0x000000000000010b  r11: 0xfefefefefefefeff
  r12: 0x000000000000010b  r13: 0x000000030efbe6c0  r14: 0x0000000000000001  r15: 0x0000000000000006
  rip: <unavailable>       rfl: 0x0000000000000283
 tmp0: 0xffffffffffffffff tmp1: 0x00000001062d6914 tmp2: 0x0000000206696a72


Binary Images:
               0x0 - 0xffffffffffffffff ??? (*) <00000000-0000-0000-0000-000000000000> ???
       0x20663a000 -        0x2066a5fff dyld (*) <71febccd-d9dc-3599-9971-2b3407c588a8> /usr/lib/dyld
       0x10ea23000 -        0x10ea82fff dyld_sim (*) <db2ea9eb-03d5-3b81-a6ce-26ec4dd81b07> /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot/usr/lib/dyld_sim

Error Formulating Crash Report:
dyld_process_snapshot_get_shared_cache failed

EOF

解决方案

1. 修复Pod依赖配置

React Native默认通过CocoaPods管理double-conversion等底层依赖,手动添加静态库/xcframework会导致冲突:

  • 打开ios/Podfile,确认包含如下配置:
    pod 'DoubleConversion', :podspec => '../node_modules/react-native/third-party-podspecs/DoubleConversion.podspec'
    
  • 执行命令清理并重新安装Pods:
    cd ios
    pod deintegrate
    pod install
    

2. 验证Xcode项目的搜索路径配置

  • 打开ios目录下的.xcworkspace,选中主项目target
  • 进入Build Settings,搜索Framework Search Paths,确保包含:
    $(SRCROOT)/../node_modules/react-native/third-party-podspecs/double-conversion
    
    将该路径的设置改为recursive
  • 搜索Runpath Search Paths,确保包含以下两项(dyld查找rpath库的关键路径):
    @executable_path/Frameworks
    @loader_path/Frameworks
    

3. 修正链接库配置

  • 进入Build Phases -> Link Binary With Libraries
  • 移除手动添加的libDoubleConversion.a和double-conversion.xcframework
  • 添加Pods管理的double-conversion.framework(路径为Pods/DoubleConversion/double-conversion.framework),并将Status设置为Required

4. 清理构建缓存

  • 清理React Native项目缓存:
    npx react-native clean
    
  • 在Xcode中执行Product -> Clean Build Folder(快捷键Cmd+Shift+K)
  • 删除Xcode的Derived Data:打开Xcode偏好设置 -> Locations -> 点击Derived Data后的路径,删除对应项目的缓存文件夹

内容的提问来源于stack exchange,提问作者omkocer

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.08.15 18:31:08