Troubleshooting Linker Errors in FullStory Integration
When upgrading your React Native project to version 0.73, you may encounter linker errors related to undefined symbols, specifically _OBJC_CLASS_$_RCTEventDispatcher. This issue often arises during the iOS build process in the App Center pipeline.
Error Overview
The error message typically looks like this:
ld: Undefined symbols:
_OBJC_CLASS_$_RCTEventDispatcher, referenced from:
__OBJC_$_CATEGORY_RCTEventDispatcher_$_Reanimated in libRNReanimated.a
in libreact-native-video.a
clang: error: linker command failed with exit code 1
This indicates that the linker cannot find the RCTEventDispatcher class, which is crucial for React Native's event handling.
Build Command Failure
You might also see a failure message similar to:
The following build commands failed:
Ld /path/to/your/project/ImageNotification normal (in target 'ImageNotification' from project 'your_project')
(1 failure)
##[error]Error: /usr/bin/xcodebuild failed with return code: 65
Podfile Configuration
To resolve this issue, ensure your Podfile is correctly configured. Below is an example of a Podfile that includes FullStory and other necessary dependencies:
# Use modular headers for compatibility
use_modular_headers!
# Function to resolve scripts with Node
def node_require(script)
require Pod::Executable.execute_command('node', ['-p', "require.resolve('#{script}', {paths: [process.argv[1]]})", __dir__]).strip
end
node_require('react-native/scripts/react_native_pods.rb')
node_require('react-native-permissions/scripts/setup.rb')
# Set Swift version
ENV['SWIFT_VERSION'] = '5.7'
# Define pods for the project
def fluz_pods
pod 'react-native-orientation-locker', :path => '../node_modules/react-native-orientation-locker'
pod 'react-native-branch', :path => '../node_modules/react-native-branch'
pod 'FullStory', :http => 'https://ios-releases.fullstory.com/fullstory-1.43.1-xcframework.tar.gz'
pod 'CocoaLumberjack/Swift'
end
# Set iOS platform version
platform :ios, '14.0'
prepare_react_native_project!
setup_permissions([
'AppTrackingTransparency',
'Bluetooth',
'Calendars',
'Camera',
'Contacts',
'LocationAlways',
'MediaLibrary',
'Microphone',
'Notifications',
'PhotoLibrary',
])
# Flipper configuration
flipper_config = ENV['NO_FLIPPER'] == '1' ? FlipperConfiguration.disabled : FlipperConfiguration.enabled
# Linkage configuration
linkage = ENV['USE_FRAMEWORKS']
if linkage != nil
Pod::UI.puts "Configuring Pod with #{linkage}ally linked Frameworks".green
use_frameworks! :linkage => linkage.to_sym
end
# Deployment target adjustments
def guard_pods_deployment_target(installer)
installer.pods_project.targets.each do |target|
target.build_configurations.each do |config|
should_upgrade = config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'].split('.')[0].to_i < 14
if should_upgrade
config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = '14'
end
end
end
end
Conclusion
By ensuring that your Podfile is correctly set up and that all necessary dependencies are included, you should be able to resolve the linker errors encountered during the build process. If issues persist, consider checking for updates to your dependencies or consulting the official documentation for further troubleshooting steps.