iOS 端配置流程
1更新 Podfile 参数
为苹果工程注入 Hermes 动力,需要修改 CocoaPods 配置文件。打开 ios/Podfile,定位到 `use_react_native!` 模块。
# 将 hermes_enabled 标志设置为 true
use_react_native!(
:path => config[:reactNativePath],
:hermes_enabled => true, # <-- 开启此项
# ... 其他配置
)
2重装依赖与验证
修改保存后,需要重新安装 Pod 依赖。系统会自动下载并编译 Hermes 引擎框架。
# 进入 ios 目录
cd ios
# 安装依赖包
pod install
# 返回根目录并启动 iOS 模拟器
cd ..
npx react-native run-ios