I’m working on an iOS app that was functioning perfectly before I added Firebase Cloud Messaging (FCM) to implement push notifications. The Android side is still working flawlessly after integrating FCM, but the iOS version won’t build anymore. Every time I try to run the app in Xcode, I encounter the same error.
here are some of my files
# Enable modular headers globally
use_modular_headers!
def node_require(script)
# Resolve script with node to allow for hoisting
require Pod::Executable.execute_command('node', ['-p',
"require.resolve(
'#{script}',
{paths: [process.argv[1]]},
)", __dir__]).strip
end
# Use it to require both react-native's and this package's scripts:
node_require('react-native/scripts/react_native_pods.rb')
node_require('react-native-permissions/scripts/setup.rb')
platform :ios, min_ios_version_supported
prepare_react_native_project!
setup_permissions([
'LocationAlways',
'LocationWhenInUse',
])
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
use_frameworks! :linkage => :static
$RNFirebaseAsStaticFramework = true
target 'OfferBoat' do
rn_maps_path = '../node_modules/react-native-maps'
pod 'react-native-google-maps', :path => rn_maps_path
config = use_native_modules!
use_react_native!(
:path => config[:reactNativePath],
# An absolute path to your application root.
:app_path => "#{Pod::Config.instance.installation_root}/.."
)
# Add GooglePlaces and GoogleMaps pods here
pod 'GooglePlaces'
pod 'GoogleMaps'
target 'OfferBoatTests' do
inherit! :complete
# Pods for testing
end
post_install do |installer|
# https://github.com/facebook/react-native/blob/main/packages/react-native/scripts/react_native_pods.rb#L197-L202
react_native_post_install(
installer,
config[:reactNativePath],
:mac_catalyst_enabled => false,
# :ccache_enabled => true
)
end
end
#import "AppDelegate.h"
#import <Firebase.h>
#import <React/RCTBundleURLProvider.h>
#import <GoogleMaps/GoogleMaps.h>
#import <GoogleSignIn/GoogleSignIn.h>
@implementation AppDelegate
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
[FIRApp configure];
[GMSServices provideAPIKey:@"AIza...iY4.....Y...nYj...Q3G...g"];
self.moduleName = @"OfferBoat";
// You can add your custom initial props in the dictionary below.
// They will be passed down to the ViewController used by React Native.
self.initialProps = @{};
return [super application:application didFinishLaunchingWithOptions:launchOptions];
}
- (NSURL *)sourceURLForBridge:(RCTBridge *)bridge
{
return [self bundleURL];
}
- (NSURL *)bundleURL
{
#if DEBUG
return [[RCTBundleURLProvider sharedSettings] jsBundleURLForBundleRoot:@"index"];
#else
return [[NSBundle mainBundle] URLForResource:@"main" withExtension:@"jsbundle"];
#endif
}
@end
I added GoogleService Info.plist file like this .
here is my package.json file
{
"name": "OfferBoat",
"version": "0.0.1",
"private": true,
"scripts": {
"android": "react-native run-android",
"ios": "react-native run-ios",
"lint": "eslint .",
"start": "react-native start",
"test": "jest"
},
"dependencies": {
"@hookform/resolvers": "^3.5.0",
"@notifee/react-native": "^7.8.2",
"@react-native-async-storage/async-storage": "^1.23.1",
"@react-native-community/datetimepicker": "^8.1.0",
"@react-native-community/geolocation": "^3.3.0",
"@react-native-firebase/app": "^20.4.0",
"@react-native-firebase/messaging": "^20.4.0",
"@react-native-google-signin/google-signin": "^12.2.1",
"@react-navigation/bottom-tabs": "^6.5.20",
"@react-navigation/native": "^6.1.17",
"@react-navigation/native-stack": "^6.9.26",
"@react-navigation/stack": "^6.3.29",
"@reduxjs/toolkit": "^2.2.5",
"@stripe/stripe-react-native": "^0.38.2",
"@types/react-redux": "^7.1.33",
"axios": "^1.7.2",
"date-fns": "^3.6.0",
"lottie-react-native": "^6.7.2",
"react": "18.2.0",
"react-hook-form": "^7.51.5",
"react-native": "0.74.2",
"react-native-calendars": "^1.1305.0",
"react-native-gesture-handler": "^2.16.2",
"react-native-get-random-values": "^1.11.0",
"react-native-google-places-autocomplete": "^2.5.6",
"react-native-image-crop-picker": "^0.41.1",
"react-native-image-zoom-viewer": "^3.0.1",
"react-native-keyboard-aware-scroll-view": "^0.9.5",
"react-native-maps": "^1.15.6",
"react-native-modal": "^13.0.1",
"react-native-modal-datetime-picker": "^17.1.0",
"react-native-permissions": "latest",
"react-native-phone-number-input": "^2.1.0",
"react-native-ratings": "^8.1.0",
"react-native-reanimated": "^3.12.0",
"react-native-reanimated-carousel": "^3.5.1",
"react-native-safe-area-context": "^4.10.4",
"react-native-screens": "^3.31.1",
"react-native-vector-icons": "^10.1.0",
"react-redux": "^9.1.2",
"yup": "^1.4.0"
},
"devDependencies": {
"@babel/core": "^7.20.0",
"@babel/preset-env": "^7.20.0",
"@babel/runtime": "^7.20.0",
"@react-native/babel-preset": "0.74.84",
"@react-native/eslint-config": "0.74.84",
"@react-native/metro-config": "0.74.84",
"@react-native/typescript-config": "0.74.84",
"@types/react": "^18.2.6",
"@types/react-native-vector-icons": "^6.4.18",
"@types/react-test-renderer": "^18.0.0",
"babel-jest": "^29.6.3",
"eslint": "^8.19.0",
"jest": "^29.6.3",
"prettier": "2.8.8",
"react-test-renderer": "18.2.0",
"typescript": "5.0.4"
},
"engines": {
"node": ">=18"
},
"packageManager": "[email protected]"
}
and yes I also added these capabilities in xcode
I’d appreciate any guidance or suggestions on how to resolve this issue. Thanks in advance!
Steps I’ve Taken:
Ran pod install –repo-update to ensure all dependencies are up to date.
Deleted Pods and Podfile.lock, then reinstalled pods using pod install.
Cleaned the build folder in Xcode (Product > Clean Build Folder).
Deleted the contents of /Users/Library/Developer/Xcode/DerivedData/.
Despite these efforts, the build error persists.
2
Answers
ok so i update my podfile like this, and its solve my issue
Maybe install the library?
https://developers.google.com/identity/sign-in/ios/start-integrating