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

React Native 0.73升级后iOS端MPGDPRConsent导入报错求助

解决RN 0.73升级后iOS的MPGDPRConsent导入报错

下面几个方案按优先级尝试:

1. 补全缺失的导入语句

找到/node_modules/react-native-mparticle/ios/RNMParticle/RNMParticle.m文件,在顶部添加一行导入:

@import mParticle_Apple_SDK.Swift;

如果上面的语句无效,替换成:

#import <mParticle_Apple_SDK/mParticle_Apple_SDK-Swift.h>

添加完成后执行pod install,再重新编译项目。

2. 调整Podfile的模块化头配置

当前Podfile的use_modular_headers!可能未正确覆盖相关依赖,尝试给指定Pod单独开启模块化头:
将原有的pod 'mParticle-Apple-SDK', '~> 8.17'替换为:

pod 'react-native-mparticle', :modular_headers => true
pod 'mParticle-Apple-SDK', '~> 8.17', :modular_headers => true

同时可以先注释掉pre_install中的动态框架设置,排查是否是该配置影响了头文件导入:

# pre_install do |installer|
#   installer.pod_targets.each do |pod|
#     if pod.name == 'mParticle-Apple-SDK'
#       def pod.build_type;
#         Pod::BuildType.new(:linkage => :dynamic, :packaging => :framework)
#       end
#     end
#   end
# end

修改后执行pod deintegrate && pod install清理并重新安装依赖。

3. 升级react-native-mparticle版本

你当前使用的2.7.12版本可能对RN 0.73和mParticle-Apple-SDK 8.17的兼容性不足,尝试升级到最新版本:

npm install react-native-mparticle@latest

升级完成后重新执行pod install再编译项目。

4. 检查Xcode的Swift编译设置

打开Xcode,进入项目Build Settings,将Always Embed Swift Standard Libraries设置为YES;如果项目中没有Swift文件,新建一个空的Swift文件,Xcode会自动生成桥接文件,确保OC与Swift能正常交互。


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

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.06.17 04:41:08