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

React Native iOS打包报错:AmplifyRTNCore.modulemap未找到及架构问题

解决React Native + AWS Amplify Xcode打包报错问题

一、处理AmplifyRTNCore/AmplifyRTNCore.modulemap not found错误

  • 验证Podfile配置:确认pod 'AmplifyRTNCore'已正确添加到Podfile中,执行pod install后检查Pods目录下是否存在该模块
  • 彻底清理重建依赖:
    1. 关闭Xcode
    2. 删除项目根目录的Pods文件夹、Podfile.lock文件
    3. 执行命令:pod deintegrate && pod install
    4. 打开Xcode后执行Product > Clean Build Folder(快捷键Cmd+Shift+K)
  • 修正Xcode Build Settings:
    • 在Header Search Paths中添加${PODS_ROOT}/AmplifyRTNCore,设置为recursive,同时保留$(inherited)
    • 若手动指定过Module Map File,将路径改为${PODS_ROOT}/AmplifyRTNCore/AmplifyRTNCore.modulemap

二、解决arm64架构下source: unbound variable的PhaseScriptExecution错误

该错误多因shell脚本兼容性或环境变量问题导致:

  • 调整脚本解释器:
    进入Xcode项目的Build Phases标签,找到[CP-User] Generate app.config for prebuilt Amplify Libraries脚本,将开头的#!/bin/sh改为#!/bin/bash
  • 替换source命令:
    若脚本中存在source调用,替换为POSIX兼容的.写法,比如将source "$SRCROOT/../node_modules/aws-amplify-react-native/scripts/amplify_config.sh"改为. "$SRCROOT/../node_modules/aws-amplify-react-native/scripts/amplify_config.sh"
  • 切换默认shell:
    在终端执行chsh -s /bin/bash(输入系统密码确认),将默认shell改为bash后重启Xcode
  • 检查Build Settings中的Shell Path,确保设置为/bin/bash

额外建议

  • 确认React Native与AWS Amplify版本兼容,优先使用官方推荐的版本组合
  • 打包时选择Release模式和正确的Scheme
  • 若Podfile中使用了use_frameworks!,尝试改为use_frameworks! :linkage => :static,避免动态库路径异常

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

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.06.26 18:57:09