zo0r / react-native-push-notification

React Native Local and Remote Notifications
MIT License
6.75k stars 2.05k forks source link

react native ios error while i installed "@react-native-firebase/messaging #2359

Closed React-RN-Pratik closed 4 months ago

React-RN-Pratik commented 1 year ago

i am using react native - 0.68.3 "@react-native-firebase/app": "^17.4.2", "@react-native-firebase/messaging": "^17.4.2",

Undefined symbol: _OBJCCLASS$_RNFBJSONUndefined symbol: _OBJCCLASS$_RNFBRCTEventEmitterUndefined symbol: _OBJCCLASS$_RNFBSharedUtilsLinker command failed with exit code 1 (use -v to see invocation)

this is my podfile require_relative '../node_modules/react-native/scripts/react_native_pods' require_relative '../node_modules/@react-native-community/cli-platform-ios/native_modules'

platform :ios, '13.0' install! 'cocoapods', :deterministic_uuids => false

$RNFirebaseAsStaticFramework = true

target 'cloud_suryalog' do config = use_native_modules!

use_frameworks!

rn_maps_path = '../node_modules/react-native-maps' pod 'react-native-google-maps', :path => rn_maps_path pod 'Google-Maps-iOS-Utils' pod 'Firebase', :modular_headers => true pod 'FirebaseCore', :modular_headers => true pod 'Firebase/Messaging', :modular_headers => true pod 'RNCPushNotificationIOS', :path => '../node_modules/@react-native-community/push-notification-ios' pod 'react-native-charts-wrapper', :path => '../node_modules/react-native-charts-wrapper' pod 'react-native-safe-area-context', :path => '../node_modules/react-native-safe-area-context' pod 'RNGestureHandler', :path => '../node_modules/react-native-gesture-handler'

Flags change depending on the env values.

flags = get_default_flags()

use_react_native!( :path => config[:reactNativePath],

to enable hermes on iOS, change false to true and then install pods

:hermes_enabled => flags[:hermes_enabled],
:fabric_enabled => flags[:fabric_enabled],
# An absolute path to your application root.
:app_path => "#{Pod::Config.instance.installation_root}/.."

)

pod 'RNFBMessaging', :path => '../node_modules/@react-native-firebase/messaging'

target 'cloud_suryalogTests' do inherit! :complete

Pods for testing

end

pod 'react-native-maps', :path => '../node_modules/react-native-maps'

pod 'RNScreens', :path => '../node_modules/react-native-screens'

pod 'RNSVG', :path => '../node_modules/react-native-svg'

pod 'RNCAsyncStorage', :path => '../node_modules/@react-native-async-storage/async-storage'

pod 'react-native-netinfo', :path => '../node_modules/@react-native-community/netinfo'

pod 'RNDeviceInfo', :path => '../node_modules/react-native-device-info'

pod 'RNCCheckbox', :path => '../node_modules/@react-native-community/checkbox'

pod 'BVLinearGradient', :path => '../node_modules/react-native-linear-gradient'

pod 'RNDateTimePicker', :path => '../node_modules/@react-native-community/datetimepicker'

pod 'react-native-pager-view', :path => '../node_modules/react-native-pager-view'

This is the whole magic starts # Hit build times and times and which library ever failing add here

$static_framework = [] $static_framework += [ 'react-native-maps', 'react-native-google-maps', 'Google-Maps-iOS-Utils', 'RNPermissions', 'Permission-LocationWhenInUse', ]

** THIS IS THE MAGIC **

pre_install do |installer| Pod::Installer::Xcode::TargetValidator.send(:define_method, :verify_no_static_framework_transitive_dependencies) {} installer.pod_targets.each do |pod| if $static_framework.include?(pod.name) def pod.build_type; Pod::BuildType.static_library end end end end

post_install do |installer|

This is also important AND MUST BE IN SAME ORDER

react_native_post_install(installer)
installer.pods_project.targets.each do |target|
  if target.name == 'react-native-google-maps'
    target.build_configurations.each do |config|
      config.build_settings['CLANG_ENABLE_MODULES'] = 'No'
      config.build_settings['BUILD_LIBRARY_FOR_DISTRIBUTION'] = 'YES'
    end
  end
end

# __apply_Xcode_12_5_M1_post_install_workaround(installer)
installer.pods_project.targets.each do |target|
  target.build_configurations.each do |config|
    # Disable arm64 builds for the simulator
    config.build_settings['EXCLUDED_ARCHS[sdk=iphonesimulator*]'] = 'arm64'
  end
end

end end

this is my appdelegate.mm

import "AppDelegate.h"

import <React/RCTBridge.h>

import <React/RCTBundleURLProvider.h>

import <React/RCTRootView.h>

import <GoogleMaps/GoogleMaps.h>

import

import <UserNotifications/UserNotifications.h>

import

import

import <React/RCTAppSetupUtils.h>

if RCT_NEW_ARCH_ENABLED

import <React/CoreModulesPlugins.h>

import <React/RCTCxxBridgeDelegate.h>

import <React/RCTFabricSurfaceHostingProxyRootView.h>

import <React/RCTSurfacePresenter.h>

import <React/RCTSurfacePresenterBridgeAdapter.h>

import <ReactCommon/RCTTurboModuleManager.h>

import <react/config/ReactNativeConfig.h>

@interface AppDelegate () <RCTCxxBridgeDelegate, RCTTurboModuleManagerDelegate> { RCTTurboModuleManager _turboModuleManager; RCTSurfacePresenterBridgeAdapter _bridgeAdapter; std::shared_ptr _reactNativeConfig; facebook::react::ContextContainer::Shared _contextContainer; } @end

endif

@implementation AppDelegate

@end

github-actions[bot] commented 5 months ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed in 30 days if no further activity occurs. Thank you for your contributions.