When upgrading your React Native project to version 0.73, you may encounter the following error related to the MPGDPRConsent definition:
/node_modules/react-native-mparticle/ios/RNMParticle/RNMParticle.m:648:34: Definition of 'MPGDPRConsent' must be imported from module 'mParticle_Apple_SDK.Swift' before it is required
Prerequisites
Ensure that your project is set to support a minimum iOS version of 13. The following configurations are necessary in your package.json and Podfile:
package.json
Make sure your dependencies are defined as follows:
{
"react": "18.2.0",
"react-native": "^0.73.0",
"react-native-mparticle": "^2.7.12"
}
Podfile Configuration
Your Podfile should specify the platform and include necessary configurations:
platform :ios, '14.0'
install! 'cocoapods', :deterministic_uuids => false
target 'myApp' do
config = use_native_modules!
use_modular_headers!
pod 'mParticle-Apple-SDK', '~> 8.17'
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
post_install do |installer|
react_native_post_install(installer)
# Exclude arm64 architecture for simulators (for Apple Silicon)
installer.pods_project.build_configurations.each do |config|
config.build_settings["EXCLUDED_ARCHS[sdk=iphonesimulator*]"] = "arm64"
end
end
end
Conclusion
After making these adjustments, you should be able to resolve the import error related to MPGDPRConsent. Ensure that you have the latest version of the mParticle SDK and that your project settings align with the requirements outlined above.