The Swift pod `ExpoModulesCore` depends upon `React-RCTAppDelegate` - ios
What a complete nightmare it is updating react-native libraries with expo. I tried updating the codebase libraries to help the my app become up to date. However, as expected, its not as easy as running a npm update --force :D. I have been going through errors for the last few days; today is day three of fixing errors until I get a successful build. Todays error is really stumping me. Anyone now how to resolve the following?:
Error
The Swift pod `ExpoModulesCore` depends upon `React-RCTAppDelegate`, which does not define modules.
I tried adding pod 'ExpoModulesCore',:modular_headers => true to my podfile but this resulted in the following error:
[!] Unable to find a specification for `ExpoModulesCore`
...Even though I have this in my package.json file which I'll add below. The name is different is in package.json it has hypens between the words. However, if I change the name to that I get the same error just with the corresponding name.
so I tried a global modular_headers but then got a name space conflict with google error. I then tried adding pod 'React-RCTAppDelegate', :modular_headers => true but I get the following error
[!] There are multiple dependencies with different sources for `React-RCTAppDelegate` in `Podfile`:
- React-RCTAppDelegate
- React-RCTAppDelegate (from `../node_modules/react-native/Libraries/AppDelegate`)
I am completely lost what to do any more, this must be error 49/xxx. I will provide my old package.json and my new one along with my podfile and delegate.m and h files. Any help is appreciated.
I downgraded expo because it helped me resolve another error I was getting related to no modules defined in reatdelegate
New Package.json
{
"scripts": {
"start": "react-native start",
"android": "react-native run-android",
"ios": "react-native run-ios",
"web": "expo start --web",
"eject": "expo eject",
"build:ios": "react-native bundle — entry-file index.js — platform ios — dev false — bundle-output ios/main.jsbundle — assets-dest ios"
},
"dependencies": {
"#expo/vector-icons": "^13.0.0",
"#gregfrench/react-native-wheel-picker": "^1.2.16",
"#react-native-community/datetimepicker": "^6.7.3",
"#react-native-community/masked-view": "0.1.10",
"#react-native-community/push-notification-ios": "^1.10.1",
"#react-native-firebase/app": "^17.0.0",
"#react-native-firebase/messaging": "^17.0.0",
"#react-native-picker/picker": "^2.4.8",
"#reduxjs/toolkit": "^1.9.2",
"#sentry/react-native": "^4.14.0",
"axios": "^1.3.2",
"buffer": "^6.0.3",
"expo": "47.0.9",
"expo-barcode-scanner": "~12.1.0",
"expo-camera": "~13.1.0",
"expo-device": "^5.0.0",
"expo-image-manipulator": "~11.0.0",
"expo-image-picker": "~14.1.0",
"expo-media-library": "~15.0.0",
"expo-modules-core": "1.1.1",
"expo-notifications": "^0.17.0",
"expo-permissions": "~14.0.0",
"expo-secure-store": "~12.0.0",
"expo-splash-screen": "^0.17.5",
"expo-sqlite": "~11.0.0",
"expo-status-bar": "~1.4.2",
"expo-updates": "^0.15.6",
"formik": "^2.2.9",
"lodash": "^4.17.21",
"moment": "^2.29.4",
"react": "18.2.0",
"react-axios": "^2.0.6",
"react-dom": "18.2.0",
"react-native": "^0.71.2",
"react-native-appearance": "^0.3.4",
"react-native-background-actions": "^3.0.0",
"react-native-background-fetch": "^4.1.8",
"react-native-ble-plx": "^2.0.3",
"react-native-calendars": "^1.1293.0",
"react-native-device-info": "^10.3.0",
"react-native-elements": "^3.4.3",
"react-native-fast-image": "^8.6.3",
"react-native-gesture-handler": "~2.9.0",
"react-native-image-slider-box": "^2.0.7",
"react-native-image-zoom-viewer": "^3.0.1",
"react-native-keyboard-aware-scrollview": "^2.1.0",
"react-native-permissions": "^3.6.1",
"react-native-push-notification": "^8.1.1",
"react-native-reanimated": "^2.14.4",
"react-native-safe-area-context": "4.5.0",
"react-native-screens": "~3.19.0",
"react-native-snap-carousel": "^3.9.1",
"react-native-switch": "^2.0.0",
"react-native-unimodules": "^0.14.10",
"react-native-web": "^0.18.12",
"react-native-webview": "^11.26.1",
"react-native-wheel-picker-android": "^2.0.6",
"react-navigation": "^4.4.3",
"react-navigation-stack": "^2.9.0",
"react-redux": "^8.0.5",
"rn-fetch-blob": "^0.12.0",
"toggle-switch-react-native": "^3.3.0"
},
"devDependencies": {
"#babel/core": "~7.20.12",
"babel-jest": "~29.4.1",
"jest": "^29.4.1",
"prettier": "^2.8.3",
"react-test-renderer": "~18.2.0",
"typescript": "~4.9.5"
},
"private": true,
"name": "pdi-app-v2",
"version": "1.0.0"
}
Old Package.json
{
"scripts": {
"start": "react-native start",
"android": "react-native run-android",
"ios": "react-native run-ios",
"web": "expo start --web",
"eject": "expo eject",
"build:ios": "react-native bundle — entry-file index.js — platform ios — dev false — bundle-output ios/main.jsbundle — assets-dest ios"
},
"dependencies": {
"#expo/vector-icons": "^10.0.0",
"#gregfrench/react-native-wheel-picker": "^1.2.14",
"#react-native-community/datetimepicker": "^3.0.9",
"#react-native-community/masked-view": "0.1.10",
"#react-native-community/push-notification-ios": "^1.7.1",
"#react-native-firebase/app": "^8.4.7",
"#react-native-firebase/messaging": "^7.9.1",
"#react-native-picker/picker": "^1.16.1",
"#reduxjs/toolkit": "^1.4.0",
"#sentry/react-native": "^3.2.10",
"axios": "^0.15.0",
"buffer": "^6.0.2",
"expo": "~39.0.2",
"expo-barcode-scanner": "~9.0.0",
"expo-camera": "~9.0.0",
"expo-device": "~2.3.0",
"expo-image-manipulator": "~8.3.0",
"expo-image-picker": "~9.1.1",
"expo-media-library": "~9.2.1",
"expo-notifications": "0.8.2",
"expo-permissions": "~9.3.0",
"expo-secure-store": "~9.2.0",
"expo-splash-screen": "~0.6.1",
"expo-sqlite": "~8.4.0",
"expo-status-bar": "~1.0.2",
"expo-updates": "~0.3.3",
"formik": "^2.2.9",
"lodash": "^4.17.21",
"moment": "^2.29.0",
"react": "16.13.1",
"react-axios": "2.0.3",
"react-dom": "16.13.1",
"react-native": "0.63.4",
"react-native-appearance": "^0.3.4",
"react-native-background-actions": "^2.6.1",
"react-native-background-fetch": "^4.0.2",
"react-native-ble-plx": "^2.0.3",
"react-native-calendars": "^1.403.0",
"react-native-device-info": "^8.1.3",
"react-native-elements": "^2.3.2",
"react-native-fast-image": "^8.3.4",
"react-native-gesture-handler": "~1.7.0",
"react-native-image-slider-box": "^1.0.12",
"react-native-image-zoom-viewer": "^3.0.1",
"react-native-keyboard-aware-scrollview": "^2.1.0",
"react-native-permissions": "^3.0.5",
"react-native-push-notification": "^6.1.3",
"react-native-reanimated": "~1.13.0",
"react-native-safe-area-context": "3.1.4",
"react-native-screens": "~2.10.1",
"react-native-snap-carousel": "^3.9.1",
"react-native-switch": "^2.0.0",
"react-native-unimodules": "~0.11.0",
"react-native-web": "0.14.0",
"react-native-webview": "^10.8.2",
"react-native-wheel-picker-android": "^2.0.6",
"react-navigation": "^4.4.3",
"react-navigation-stack": "^2.9.0",
"react-redux": "^7.2.2",
"rn-fetch-blob": "^0.12.0",
"toggle-switch-react-native": "^2.3.0"
},
"devDependencies": {
"#babel/core": "~7.9.0",
"babel-jest": "~25.2.6",
"jest": "~25.2.6",
"prettier": "^2.5.1",
"react-test-renderer": "~16.13.1",
"typescript": "~3.9.2"
},
"private": true,
"name": "pdi-app-v2",
"version": "1.0.0"
}
#Podfile
require File.join(File.dirname(`node --print "require.resolve('expo/package.json')"`), "scripts/autolinking")
require File.join(File.dirname(`node --print "require.resolve('react-native/package.json')"`), "scripts/react_native_pods")
require File.join(File.dirname(`node --print "require.resolve('#react-native-community/cli-platform-ios/package.json')"`), "native_modules")
pod 'Firebase', :modular_headers => true
pod 'FirebaseCore', :modular_headers => true
pod 'GoogleUtilities', :modular_headers => true
pod 'React-RCTAppDelegate', :modular_headers => true
$RNFirebaseAsStaticFramework = true
require 'json'
podfile_properties = JSON.parse(File.read(File.join(__dir__, 'Podfile.properties.json'))) rescue {}
platform :ios, podfile_properties['ios.deploymentTarget'] || '13.0'
install! 'cocoapods',
:deterministic_uuids => false
target 'pdimobile' do
use_expo_modules!
config = use_native_modules!
use_frameworks! :linkage => podfile_properties['ios.useFrameworks'].to_sym if podfile_properties['ios.useFrameworks']
# Flags change depending on the env values.
flags = get_default_flags()
use_flipper! # should match the version of your Flipper client app
use_react_native!(
:path => config[:reactNativePath],
:hermes_enabled => podfile_properties['expo.jsEngine'] == 'hermes',
:fabric_enabled => flags[:fabric_enabled],
# An absolute path to your application root.
:app_path => "#{Pod::Config.instance.installation_root}/..",
)
post_install do |installer|
flipper_post_install(installer)
react_native_post_install(
installer,
# Set `mac_catalyst_enabled` to `true` in order to apply patches
# necessary for Mac Catalyst builds
:mac_catalyst_enabled => false
)
__apply_Xcode_12_5_M1_post_install_workaround(installer)
# This is necessary for Xcode 14, because it signs resource bundles by default
# when building for devices.
installer.target_installation_results.pod_target_installation_results
.each do |pod_name, target_installation_result|
target_installation_result.resource_bundle_targets.each do |resource_bundle_target|
resource_bundle_target.build_configurations.each do |config|
config.build_settings['CODE_SIGNING_ALLOWED'] = 'NO'
end
end
end
end
permissions_path = '../node_modules/react-native-permissions/ios'
pod 'Permission-BluetoothPeripheral', :path => "#{permissions_path}/BluetoothPeripheral"
pod 'Permission-Camera', :path => "#{permissions_path}/Camera"
pod 'Permission-Notifications', :path => "#{permissions_path}/Notifications"
pod 'Permission-PhotoLibrary', :path => "#{permissions_path}/PhotoLibrary"
post_integrate do |installer|
begin
expo_patch_react_imports!(installer)
rescue => e
Pod::UI.warn e
end
begin
expo_patch_react_imports!(installer)
rescue => e
Pod::UI.warn e
end
end
end
#AppDelegate.h
#import <UserNotifications/UNUserNotificationCenter.h>
#import <Expo/Expo.h>
#import <Foundation/Foundation.h>
#import <EXUpdates/EXUpdatesAppController.h>
#import <React/RCTBridgeDelegate.h>
#import <UIKit/UIKit.h>
#import <UMCore/UMAppDelegateWrapper.h>
#interface AppDelegate : UMAppDelegateWrapper <RCTBridgeDelegate, EXUpdatesAppControllerDelegate, UNUserNotificationCenterDelegate>
#end
AppDelegate.m
#import <Firebase.h>
#import "AppDelegate.h"
#import <UserNotifications/UserNotifications.h>
#import <RNCPushNotificationIOS.h>
#import <React/RCTBridge.h>
#import <React/RCTBundleURLProvider.h>
#import <React/RCTRootView.h>
#import <TSBackgroundFetch/TSBackgroundFetch.h>
#if RCT_DEV
#import <React/RCTDevLoadingView.h>
#endif
#import <UMCore/UMModuleRegistry.h>
#import <UMReactNativeAdapter/UMNativeModulesProxy.h>
#import <UMReactNativeAdapter/UMModuleRegistryAdapter.h>
#import <EXSplashScreen/EXSplashScreenService.h>
#import <UMCore/UMModuleRegistryProvider.h>
#ifdef FB_SONARKIT_ENABLED
#import <FlipperKit/FlipperClient.h>
#import <FlipperKitLayoutPlugin/FlipperKitLayoutPlugin.h>
#import <FlipperKitUserDefaultsPlugin/FKUserDefaultsPlugin.h>
#import <FlipperKitNetworkPlugin/FlipperKitNetworkPlugin.h>
#import <SKIOSNetworkPlugin/SKIOSNetworkAdapter.h>
#import <FlipperKitReactPlugin/FlipperKitReactPlugin.h>
static void InitializeFlipper(UIApplication *application) {
FlipperClient *client = [FlipperClient sharedClient];
SKDescriptorMapper *layoutDescriptorMapper = [[SKDescriptorMapper alloc] initWithDefaults];
[client addPlugin:[[FlipperKitLayoutPlugin alloc] initWithRootNode:application withDescriptorMapper:layoutDescriptorMapper]];
[client addPlugin:[[FKUserDefaultsPlugin alloc] initWithSuiteName:nil]];
[client addPlugin:[FlipperKitReactPlugin new]];
[client addPlugin:[[FlipperKitNetworkPlugin alloc] initWithNetworkAdapter:[SKIOSNetworkAdapter new]]];
[client start];
}
#endif
#interface AppDelegate () <RCTBridgeDelegate>
#property (nonatomic, strong) UMModuleRegistryAdapter *moduleRegistryAdapter;
#property (nonatomic, strong) NSDictionary *launchOptions;
#end
#implementation AppDelegate
// Required for the register event.
- (void)application:(UIApplication *)application didRegisterForRemoteNotificationsWithDeviceToken:(NSData *)deviceToken
{
[RNCPushNotificationIOS didRegisterForRemoteNotificationsWithDeviceToken:deviceToken];
}
// Required for the notification event. You must call the completion handler after handling the remote notification.
- (void)application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo
fetchCompletionHandler:(void (^)(UIBackgroundFetchResult))completionHandler
{
[RNCPushNotificationIOS didReceiveRemoteNotification:userInfo fetchCompletionHandler:completionHandler];
}
// Required for the registrationError event.
- (void)application:(UIApplication *)application didFailToRegisterForRemoteNotificationsWithError:(NSError *)error
{
[RNCPushNotificationIOS didFailToRegisterForRemoteNotificationsWithError:error];
}
// Required for localNotification event
- (void)userNotificationCenter:(UNUserNotificationCenter *)center
didReceiveNotificationResponse:(UNNotificationResponse *)response
withCompletionHandler:(void (^)(void))completionHandler
{
[RNCPushNotificationIOS didReceiveNotificationResponse:response];
}
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
#ifdef FB_SONARKIT_ENABLED
InitializeFlipper(application);
#endif
self.moduleRegistryAdapter = [[UMModuleRegistryAdapter alloc] initWithModuleRegistryProvider:[[UMModuleRegistryProvider alloc] init]];
self.launchOptions = launchOptions;
self.window = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds];
#ifdef DEBUG
[self initializeReactNativeApp];
#else
EXUpdatesAppController *controller = [EXUpdatesAppController sharedInstance];
controller.delegate = self;
[controller startAndShowLaunchScreen:self.window];
#endif
[super application:application didFinishLaunchingWithOptions:launchOptions];
if([FIRApp defaultApp] == nil) {
[FIRApp configure];
}
NSURL *jsCodeLocation;
jsCodeLocation = [[RCTBundleURLProvider sharedSettings] jsBundleURLForBundleRoot:#"index"];
RCTBridge *bridge = [[RCTBridge alloc] initWithBundleURL:jsCodeLocation
moduleProvider:nil
launchOptions:launchOptions];
#if RCT_DEV
[bridge moduleForClass:[RCTDevLoadingView class]];
#endif
RCTRootView *rootView = [self.reactDelegate createRootViewWithBridge:bridge
moduleName:#"Test"
initialProperties:nil];
UNUserNotificationCenter *center = [UNUserNotificationCenter currentNotificationCenter];
center.delegate = self;
[[TSBackgroundFetch sharedInstance] didFinishLaunching];
return YES;
}
//Called when a notification is delivered to a foreground app.
-(void)userNotificationCenter:(UNUserNotificationCenter *)center willPresentNotification:(UNNotification *)notification withCompletionHandler:(void (^)(UNNotificationPresentationOptions options))completionHandler
{
if (#available(iOS 14.0, *)) {
completionHandler(UNNotificationPresentationOptionSound | UNNotificationPresentationOptionBanner | UNNotificationPresentationOptionBadge);
} else {
// Fallback on earlier versions
completionHandler(UNNotificationPresentationOptionSound | UNNotificationPresentationOptionAlert | UNNotificationPresentationOptionBadge);
}
}
- (RCTBridge *)initializeReactNativeApp
{
RCTBridge *bridge = [self.reactDelegate createBridgeWithDelegate:self launchOptions:self.launchOptions];
RCTRootView *rootView = [self.reactDelegate createRootViewWithBridge:bridge moduleName:#"main" initialProperties:nil];
rootView.backgroundColor = [[UIColor alloc] initWithRed:1.0f green:1.0f blue:1.0f alpha:1];
UIViewController *rootViewController = [self.reactDelegate createRootViewController];
rootViewController.view = rootView;
self.window.rootViewController = rootViewController;
[self.window makeKeyAndVisible];
return bridge;
}
- (NSArray<id<RCTBridgeModule>> *)extraModulesForBridge:(RCTBridge *)bridge
{
NSArray<id<RCTBridgeModule>> *extraModules = [_moduleRegistryAdapter extraModulesForBridge:bridge];
// If you'd like to export some custom RCTBridgeModules that are not Expo modules, add them here!
return extraModules;
}
- (NSURL *)sourceURLForBridge:(RCTBridge *)bridge {
#ifdef DEBUG
return [[RCTBundleURLProvider sharedSettings] jsBundleURLForBundleRoot:#"index"];
#else
return [[EXUpdatesAppController sharedInstance] launchAssetUrl];
#endif
}
- (void)appController:(EXUpdatesAppController *)appController didStartWithSuccess:(BOOL)success {
appController.bridge = [self initializeReactNativeApp];
EXSplashScreenService *splashScreenService = (EXSplashScreenService *)[UMModuleRegistryProvider getSingletonModuleForClass:[EXSplashScreenService class]];
[splashScreenService showSplashScreenFor:self.window.rootViewController];
}
#end
Related
DynamicLinks iOS: await dynamicLinks().getInitialLink() works on debug, but doesn't work on release mode
await dynamicLinks().getInitialLink() works in debug mode, but doesn't work in release mode on iOS. await dynamicLinks().getInitialLink() work fine for android debug and release mode but when i use dynamic link in debug mode it work fine but when i create release mode for app this will return always null. not getting after sometimes of wait because i research on that issue somebody getting link after some wait of times but in my case it will not return any link after wait of sometimes. I spent a day for finding the solution for that but nothing work for me. I tried all most the solution which mention in #2660 #4548 #3450 but not work any solution for me. Project Files export const getInitialLink = async ()=> { const link = await dynamicLinks().getInitialLink(); const id = onHandleDynamicLink(link); return id; }; export const onHandleDynamicLink = link => { if (link) { const linkUrl = url.parse(link.url, true); const VideoId = linkUrl.path.split('/')[2]; return VideoId; } return null; }; import {getInitialLink} from '../../helpers/dynamicLinksHelper'; const Id = await getInitialLink();` package.json: "#react-native-firebase/app": "^16.4.6", "#react-native-firebase/dynamic-links": "^16.4.6", "react-native": "0.64.2", iOS source 'https://github.com/CocoaPods/Specs.git target 'project' do config = use_native_modules! use_react_native!( :path => config[:reactNativePath], # to enable hermes on iOS, change `false` to `true` and then install pods :hermes_enabled => false ) pod 'Firebase', :modular_headers => true pod 'FirebaseCoreInternal', :modular_headers => true pod 'GoogleUtilities', :modular_headers => true pod 'FirebaseCore', :modular_headers => true # add the Firebase pod for Google Analytics # pod 'Firebase/Analytics' # pod 'react-native-webview', :path => '../node_modules/react-native-webview' # pod 'RNAWSCognito', :path => '../node_modules/amazon-cognito-identity-js' # pod 'FBLazyVector', :path => "../node_modules/react-native/Libraries/FBLazyVector" # pod 'RNDeviceInfo', :path => '../node_modules/react-native-device-info' target 'newslineisitanywayTests' do inherit! :complete # Pods for testing end # Enables Flipper. # # Note that if you have use_frameworks! enabled, Flipper will not work and # you should disable the next line. use_flipper!() post_install do |installer| react_native_post_install(installer) end end AppDelegate.m: #import "AppDelegate.h" #import <React/RCTLinkingManager.h> #import <RNFBDynamicLinksAppDelegateInterceptor.h> #import <React/RCTBridge.h> #import <React/RCTBundleURLProvider.h> #import <React/RCTRootView.h> #import <UserNotifications/UserNotifications.h> #import <RNCPushNotificationIOS.h> #import Firebase; #import "RNFBMessagingModule.h" #ifdef FB_SONARKIT_ENABLED #import <FlipperKit/FlipperClient.h> #import <FlipperKitLayoutPlugin/FlipperKitLayoutPlugin.h> #import <FlipperKitUserDefaultsPlugin/FKUserDefaultsPlugin.h> #import <FlipperKitNetworkPlugin/FlipperKitNetworkPlugin.h> #import <SKIOSNetworkPlugin/SKIOSNetworkAdapter.h> #import <FlipperKitReactPlugin/FlipperKitReactPlugin.h> static void InitializeFlipper(UIApplication *application) { FlipperClient *client = [FlipperClient sharedClient]; SKDescriptorMapper *layoutDescriptorMapper = [[SKDescriptorMapper alloc] initWithDefaults]; [client addPlugin:[[FlipperKitLayoutPlugin alloc] initWithRootNode:application withDescriptorMapper:layoutDescriptorMapper]]; [client addPlugin:[[FKUserDefaultsPlugin alloc] initWithSuiteName:nil]]; [client addPlugin:[FlipperKitReactPlugin new]]; [client addPlugin:[[FlipperKitNetworkPlugin alloc] initWithNetworkAdapter:[SKIOSNetworkAdapter new]]]; [client start]; } #endif #implementation AppDelegate - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { [RNFBDynamicLinksAppDelegateInterceptor sharedInstance]; #ifdef FB_SONARKIT_ENABLED InitializeFlipper(application); #endif`your text` UNUserNotificationCenter *center = [UNUserNotificationCenter currentNotificationCenter]; center.delegate = self; NSDictionary *appProperties = [RNFBMessagingModule addCustomPropsToUserProps:nil withLaunchOptions:launchOptions]; RCTBridge *bridge = [[RCTBridge alloc] initWithDelegate:self launchOptions:launchOptions]; RCTRootView *rootView = [[RCTRootView alloc] initWithBridge:bridge moduleName:#"newslineisitanyway" initialProperties:appProperties]; if (#available(iOS 13.0, *)) { rootView.backgroundColor = [UIColor systemBackgroundColor]; } else { rootView.backgroundColor = [UIColor whiteColor]; } [[FBSDKApplicationDelegate sharedInstance] application:application didFinishLaunchingWithOptions:launchOptions]; self.window = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds]; UIViewController *rootViewController = [UIViewController new]; rootViewController.view = rootView; self.window.rootViewController = rootViewController; [self.window makeKeyAndVisible]; [FIRApp configure]; return YES; } - (BOOL)application:(UIApplication *)application openURL:(NSURL *)url sourceApplication:(NSString *)sourceApplication annotation:(id)annotation { return [[FBSDKApplicationDelegate sharedInstance] application:application openURL:url sourceApplication:sourceApplication annotation:annotation]; } - (void)applicationDidBecomeActive:(UIApplication *)application { [FBSDKAppEvents activateApp]; } // Required for the register event. - (void)application:(UIApplication *)application didRegisterForRemoteNotificationsWithDeviceToken:(NSData *)deviceToken { // [RNCPushNotificationIOS didRegisterForRemoteNotificationsWithDeviceToken:deviceToken]; } // Required for the notification event. You must call the completion handler after handling the remote notification. - (void)application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo fetchCompletionHandler:(void (^)(UIBackgroundFetchResult))completionHandler { // [RNCPushNotificationIOS didReceiveRemoteNotification:userInfo fetchCompletionHandler:completionHandler]; } // Required for the registrationError event. - (void)application:(UIApplication *)application didFailToRegisterForRemoteNotificationsWithError:(NSError *)error { // [RNCPushNotificationIOS didFailToRegisterForRemoteNotificationsWithError:error]; } // Required for localNotification event - (void)userNotificationCenter:(UNUserNotificationCenter *)center didReceiveNotificationResponse:(UNNotificationResponse *)response withCompletionHandler:(void (^)(void))completionHandler { // [RNCPushNotificationIOS didReceiveNotificationResponse:response]; } -(void)userNotificationCenter:(UNUserNotificationCenter *)center willPresentNotification:(UNNotification *)notification withCompletionHandler:(void (^)(UNNotificationPresentationOptions options))completionHandler { completionHandler(UNNotificationPresentationOptionSound | UNNotificationPresentationOptionAlert | UNNotificationPresentationOptionBadge); } - (NSURL *)sourceURLForBridge:(RCTBridge *)bridge { #if DEBUG return [[RCTBundleURLProvider sharedSettings] jsBundleURLForBundleRoot:#"index" fallbackResource:nil]; #else return [[NSBundle mainBundle] URLForResource:#"main" withExtension:#"jsbundle"]; #endif } - (BOOL)application:(UIApplication *)application continueUserActivity:(nonnull NSUserActivity *)userActivity restorationHandler:(nonnull void (^)(NSArray<id<UIUserActivityRestoring>> * _Nullable))restorationHandler { return [RCTLinkingManager application:application continueUserActivity:userActivity restorationHandler:restorationHandler]; } - (BOOL)application:(UIApplication *)application openURL:(NSURL *)url options:(NSDictionary<UIApplicationOpenURLOptionsKey,id> *)options { RNFBDynamicLinksAppDelegateInterceptor *interceptor = [RNFBDynamicLinksAppDelegateInterceptor sharedInstance]; if (url && !interceptor.initialLinkUrl) { FIRDynamicLink *dynamicLink = [[FIRDynamicLinks dynamicLinks] dynamicLinkFromCustomSchemeURL:url]; if (dynamicLink.url) { interceptor.initialLinkUrl = dynamicLink.url.absoluteString; interceptor.initialLinkMinimumAppVersion = dynamicLink.minimumAppVersion == nil ? [NSNull null] : dynamicLink.minimumAppVersion; } } return [RCTLinkingManager application:application openURL:url options:options]; return YES; } #end` Environment react-native info output: Platform that you're experiencing the issue on: [x] iOSyour text Are you using TypeScript? NO
Error when adding firebase to React Native iOS app
I am having this error when running React-Native iOS App after adding Firebase and the googleserviceinfo.plist file. I have followed the instructions and I am Getting this error: 2022-10-04 23:35:59.711 xcodebuild[38171:508367] [MT] IDEFileReferenceDebug: [Load] <IDESwiftPackageCore.IDESwiftPackageSpecialFolderFileReference, 0x146d065c0: name:Docs.docc path:group:Docs.docc> Failed to load container at path: /Users/suvin/Library/Developer/Xcode/DerivedData/BoundaryTestApp-ekpfrimpksdanhevovuosfavhjwg/SourcePackages/checkouts/swift-protobuf/Sources/protoc-gen-swift/Docs.docc, Error: Error Domain=com.apple.dt.IDEContainerErrorDomain Code=6 "Cannot open "Docs.docc" as a "Swift Package Folder" because it is already open as a "Folder"." UserInfo={NSLocalizedDescription=Cannot open "Docs.docc" as a "Swift Package Folder" because it is already open as a "Folder".} ** BUILD FAILED ** The following build commands failed: CompileC /Users/suvin/Library/Developer/Xcode/DerivedData/BoundaryTestApp-ekpfrimpksdanhevovuosfavhjwg/Build/Intermediates.noindex/Pods.build/Debug-iphonesimulator/React-logger.build/Objects-normal/arm64/react_native_log.o /Users/suvin/Documents/GitHub/react-native-geofence-example-master/node_modules/react-native/ReactCommon/logger/react_native_log.cpp normal arm64 c++ com.apple.compilers.llvm.clang.1_0.compiler (in target 'React-logger' from project 'Pods') (1 failure) This is my AppDelegate.m file #import <UserNotifications/UserNotifications.h> #import <RNCPushNotificationIOS.h> #import "AppDelegate.h" #import UIKit; #import FirebaseCore; #import <React/RCTBridge.h> #import <React/RCTBundleURLProvider.h> #import <React/RCTRootView.h> #ifdef FB_SONARKIT_ENABLED #import <FlipperKit/FlipperClient.h> #import <FlipperKitLayoutPlugin/FlipperKitLayoutPlugin.h> #import <FlipperKitUserDefaultsPlugin/FKUserDefaultsPlugin.h> #import <FlipperKitNetworkPlugin/FlipperKitNetworkPlugin.h> #import <SKIOSNetworkPlugin/SKIOSNetworkAdapter.h> #import <FlipperKitReactPlugin/FlipperKitReactPlugin.h> static void InitializeFlipper(UIApplication *application) { FlipperClient *client = [FlipperClient sharedClient]; SKDescriptorMapper *layoutDescriptorMapper = [[SKDescriptorMapper alloc] initWithDefaults]; [client addPlugin:[[FlipperKitLayoutPlugin alloc] initWithRootNode:application withDescriptorMapper:layoutDescriptorMapper]]; [client addPlugin:[[FKUserDefaultsPlugin alloc] initWithSuiteName:nil]]; [client addPlugin:[FlipperKitReactPlugin new]]; [client addPlugin:[[FlipperKitNetworkPlugin alloc] initWithNetworkAdapter:[SKIOSNetworkAdapter new]]]; [client start]; } #endif #implementation AppDelegate - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { [FIRApp configure]; return YES; #ifdef FB_SONARKIT_ENABLED InitializeFlipper(application); #endif RCTBridge *bridge = [[RCTBridge alloc] initWithDelegate:self launchOptions:launchOptions]; RCTRootView *rootView = [[RCTRootView alloc] initWithBridge:bridge moduleName:#"BoundaryTestApp" initialProperties:nil]; if (#available(iOS 13.0, *)) { rootView.backgroundColor = [UIColor systemBackgroundColor]; } else { rootView.backgroundColor = [UIColor whiteColor]; } self.window = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds]; UIViewController *rootViewController = [UIViewController new]; rootViewController.view = rootView; self.window.rootViewController = rootViewController; [self.window makeKeyAndVisible]; // Define UNUserNotificationCenter UNUserNotificationCenter *center = [UNUserNotificationCenter currentNotificationCenter]; center.delegate = self; return YES; } - (NSURL *)sourceURLForBridge:(RCTBridge *)bridge { #if DEBUG return [[RCTBundleURLProvider sharedSettings] jsBundleURLForBundleRoot:#"index" fallbackResource:nil]; #else return [[NSBundle mainBundle] URLForResource:#"main" withExtension:#"jsbundle"]; #endif } //Called when a notification is delivered to a foreground app. -(void)userNotificationCenter:(UNUserNotificationCenter *)center willPresentNotification:(UNNotification *)notification withCompletionHandler:(void (^)(UNNotificationPresentationOptions options))completionHandler { completionHandler(UNNotificationPresentationOptionSound | UNNotificationPresentationOptionAlert | UNNotificationPresentationOptionBadge); } // Required for the register event. - (void)application:(UIApplication *)application didRegisterForRemoteNotificationsWithDeviceToken:(NSData *)deviceToken { [RNCPushNotificationIOS didRegisterForRemoteNotificationsWithDeviceToken:deviceToken]; } // Required for the notification event. You must call the completion handler after handling the remote notification. - (void)application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo fetchCompletionHandler:(void (^)(UIBackgroundFetchResult))completionHandler { [RNCPushNotificationIOS didReceiveRemoteNotification:userInfo fetchCompletionHandler:completionHandler]; } // Required for the registrationError event. - (void)application:(UIApplication *)application didFailToRegisterForRemoteNotificationsWithError:(NSError *)error { [RNCPushNotificationIOS didFailToRegisterForRemoteNotificationsWithError:error]; } // Required for localNotification event - (void)userNotificationCenter:(UNUserNotificationCenter *)center didReceiveNotificationResponse:(UNNotificationResponse *)response withCompletionHandler:(void (^)(void))completionHandler { [RNCPushNotificationIOS didReceiveNotificationResponse:response]; } #end This is my package.json { "name": "BoundaryTestApp", "version": "0.0.1", "private": true, "scripts": { "android": "react-native run-android", "ios": "react-native run-ios", "start": "react-native start", "test": "jest", "lint": "eslint ." }, "dependencies": { "#react-native-community/push-notification-ios": "^1.10.1", "#react-native-firebase/app": "^15.7.0", "#react-native-picker/picker": "^2.4.6", "#react-native/normalize-color": "^2.0.0", "#react-navigation/bottom-tabs": "^6.4.0", "#react-navigation/native": "^6.0.13", "#react-navigation/native-stack": "^6.9.0", "deprecated-react-native-prop-types": "^2.3.0", "react": "17.0.2", "react-native": "0.66.1", "react-native-boundary": "github:ridvanaltun/react-native-boundary#b4d143406b41e866754b5a5fd0275bbd42949ab8", "react-native-config": "^1.4.5", "react-native-elements": "^3.4.2", "react-native-flash-message": "^0.3.1", "react-native-get-location": "^2.2.1", "react-native-image-picker": "^4.10.0", "react-native-linear-gradient": "^2.6.2", "react-native-maps": "0.30.1", "react-native-permissions": "^3.1.0", "react-native-picker": "^4.3.7", "react-native-picker-select": "^8.0.4", "react-native-push-notification": "^8.1.1", "react-native-radio-buttons-group": "^2.2.11", "react-native-safe-area-context": "^4.4.1", "react-native-screen": "^1.0.1", "react-native-screens": "^3.17.0", "react-native-simple-radio-button": "^2.7.4", "react-native-svg": "^13.2.0", "react-native-svg-transformer": "^1.0.0", "react-native-vector-icons": "^9.2.0" }, "devDependencies": { "#babel/core": "^7.15.8", "#babel/runtime": "^7.15.4", "#react-native-community/eslint-config": "^3.0.1", "babel-jest": "^27.3.1", "eslint": "^8.1.0", "jest": "^27.3.1", "metro-react-native-babel-preset": "^0.66.2", "react-test-renderer": "17.0.2" }, "jest": { "preset": "react-native" } } 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, '11.0' target 'BoundaryTestApp' do config = use_native_modules! use_modular_headers! use_react_native!( :path => config[:reactNativePath], # to enable hermes on iOS, change `false` to `true` and then install pods :hermes_enabled => false ) target 'BoundaryTestAppTests' do inherit! :complete # Pods for testing end permissions_path = '../node_modules/react-native-permissions/ios' pod 'Permission-LocationAlways', :path => "#{permissions_path}/LocationAlways" # Enables Flipper. # # Note that if you have use_frameworks! enabled, Flipper will not work and # you should disable the next line. use_flipper!() post_install do |installer| react_native_post_install(installer) __apply_Xcode_12_5_M1_post_install_workaround(installer) end end
IOS application is not starting - i can only see the splash screen then it fade out without starting
I have a React-Native project. This project begun with Expo then it has been ejected switched to react-native. Last week i have updated an expo library that was available in it, i begins to get errors and i was not able to start the project anymore. What i have made, i have removed all expo libraries used, and i have succeeded to start it up on android... But on IOS, it's running without debug problems, but when i start the app it shows the splash screen then it fadeout without starting the first app screen. It seems like onSplashscreen.hide, its not opening the app first screen this is the package.json file (and the changes i have made (git)) This is the appDelegate.m { "name": "~~~~~~", "version": "2.0.0", "private": true, "main": "./index.js", "scripts": { "start": "react-native start", "android": "react-native run-android", "ios": "react-native run-ios", "web": "expo start --web", "eject": "expo eject", "open:android": "open -a /Applications/Android\\ Studio.app ./android", "compile": "tsc --noEmit", "debug": "open 'rndebugger://set-debugger-loc?host=localhost&port=8081'" }, "dependencies": { "#babel/plugin-proposal-decorators": "^7.17.2", "#eva-design/eva": "^2.0.0", "#react-native-clipboard/clipboard": "^1.9.0", "#react-native-community/async-storage": "^1.12.1", "#react-native-community/cameraroll": "^4.1.2", "#react-native-community/datetimepicker": "^3.2.0", "#react-native-community/masked-view": "0.1.10", "#react-native-community/netinfo": "^6.0.0", "#react-native-picker/picker": "^1.9.12", "#react-navigation/bottom-tabs": "^5.10.0", "#react-navigation/native": "^5.8.0", "#react-navigation/stack": "^5.10.0", "#ui-kitten/components": "^5.0.0", "add": "^2.0.6", "axios": "^0.21.0", "babel-preset-expo": "^9.0.2", "class-transformer": "^0.4.0", "class-validator": "~0.11.1", "color": "^3.1.3", "expo-app-loading": "^1.3.0", "expo-modules-core": "^0.6.5", "formik": "^2.2.1", "lodash": "^4.17.20", "lottie-ios": "3.1.8", "lottie-react-native": "3.5.0", "mobx": "5.15.7", "mobx-react": "6.3.1", "mobx-state-tree": "^3.17.2", "moment": "^2.29.1", "native-base": "^2.15.2", "react": "^17.0.2", "react-dom": "16.13.1", "react-native": "~0.63.4", "react-native-change-icon": "^3.0.0", "react-native-collapsible": "1.5.3", "react-native-elements": "^3.3.1", "react-native-gesture-handler": "~1.8.0", "react-native-image-zoom-viewer": "^3.0.1", "react-native-keyboard-aware-scroll-view": "^0.9.3", "react-native-markdown-renderer": "^3.2.8", "react-native-modal": "^11.10.0", "react-native-modal-datetime-picker": "^9.2.0", "react-native-onesignal": "~4.0.3", "react-native-picker-select": "^8.0.4", "react-native-reanimated": "~1.13.0", "react-native-safe-area-context": "3.1.9", "react-native-screens": "~2.15.2", "react-native-signature-capture": "^0.4.11", "react-native-skeleton-placeholder": "^3.0.4", "react-native-smooth-pincode-input": "^1.0.9", "react-native-splash-screen": "^3.3.0", "react-native-step-indicator": "^1.0.3", "react-native-svg": "^12.1.0", "react-native-svg-transformer": "^0.14.3", "react-native-tiny-toast": "^1.0.7", "react-native-web": "~0.13.12", "react-native-webview": "10.7.0", "react-redux": "^7.2.3", "reanimated-bottom-sheet": "^1.0.0-alpha.22", "redux": "^4.0.5", "redux-devtools-extension": "^2.13.9", "redux-thunk": "^2.3.0", "reflect-metadata": "^0.1.13", "rxjs": "^6.6.3", "uuid": "^8.3.2", "yarn": "^1.22.10", "yup": "^0.32.9" }, "devDependencies": { "#babel/core": "~7.9.0", "#types/color": "^3.0.1", "#types/lodash": "^4.14.162", "#types/react": "~16.9.35", "#types/react-dom": "~16.9.8", "#types/react-native": "~0.63.2", "#types/react-native-signature-capture": "^0.4.1", "#types/react-redux": "^7.1.16", "#types/remote-redux-devtools": "^0.5.4", "#types/yup": "^0.29.8", "#typescript-eslint/eslint-plugin": "^4.6.0", "#typescript-eslint/parser": "^4.6.0", "babel-jest": "~25.2.6", "eslint": "^7.12.1", "eslint-config-prettier": "^6.15.0", "eslint-plugin-prettier": "^3.1.4", "eslint-plugin-react": "^7.21.5", "eslint-plugin-react-hooks": "^4.2.0", "eslint-plugin-react-native": "^3.10.0", "husky": "^4.3.0", "jest": "~25.2.6", "prettier": "^2.1.2", "react-test-renderer": "~16.13.1", "typescript": "~3.9.5" } } This is the appdelegate.m #import "AppDelegate.h" #import <React/RCTBridge.h> #import <React/RCTBundleURLProvider.h> #import <React/RCTRootView.h> // #import <UMCore/UMModuleRegistry.h> // #import <UMReactNativeAdapter/UMNativeModulesProxy.h> // #import <UMReactNativeAdapter/UMModuleRegistryAdapter.h> // #import <EXSplashScreen/EXSplashScreenService.h> // #import <UMCore/UMModuleRegistryProvider.h> #import <React/RCTLinkingManager.h> #interface AppDelegate () <RCTBridgeDelegate> // #property (nonatomic, strong) UMModuleRegistryAdapter *moduleRegistryAdapter; #property (nonatomic, strong) NSDictionary *launchOptions; #end #implementation AppDelegate - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { // self.moduleRegistryAdapter = [[UMModuleRegistryAdapter alloc] initWithModuleRegistryProvider:[[UMModuleRegistryProvider alloc] init]]; self.launchOptions = launchOptions; self.window = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds]; #ifdef DEBUG [self initializeReactNativeApp]; #else EXUpdatesAppController *controller = [EXUpdatesAppController sharedInstance]; controller.delegate = self; [controller startAndShowLaunchScreen:self.window]; #endif // [super application:application didFinishLaunchingWithOptions:launchOptions]; return YES; } - (RCTBridge *)initializeReactNativeApp { RCTBridge *bridge = [[RCTBridge alloc] initWithDelegate:self launchOptions:self.launchOptions]; RCTRootView *rootView = [[RCTRootView alloc] initWithBridge:bridge moduleName:#"main" initialProperties:nil]; rootView.backgroundColor = [[UIColor alloc] initWithRed:1.0f green:1.0f blue:1.0f alpha:1]; UIViewController *rootViewController = [UIViewController new]; rootViewController.view = rootView; self.window.rootViewController = rootViewController; [self.window makeKeyAndVisible]; return bridge; } // - (NSArray<id<RCTBridgeModule>> *)extraModulesForBridge:(RCTBridge *)bridge // { // NSArray<id<RCTBridgeModule>> *extraModules = [_moduleRegistryAdapter extraModulesForBridge:bridge]; // // If you'd like to export some custom RCTBridgeModules that are not Expo modules, add them here! // return extraModules; // } - (NSURL *)sourceURLForBridge:(RCTBridge *)bridge { #ifdef DEBUG return [[RCTBundleURLProvider sharedSettings] jsBundleURLForBundleRoot:#"index" fallbackResource:nil]; #else return [[EXUpdatesAppController sharedInstance] launchAssetUrl]; #endif } // - (void)appController:(EXUpdatesAppController *)appController didStartWithSuccess:(BOOL)success { // appController.bridge = [self initializeReactNativeApp]; // EXSplashScreenService *splashScreenService = (EXSplashScreenService *)[UMModuleRegistryProvider getSingletonModuleForClass:[EXSplashScreenService class]]; // [splashScreenService showSplashScreenFor:self.window.rootViewController]; // } - (BOOL)application:(UIApplication *)application openURL:(NSURL *)url options:(NSDictionary<UIApplicationOpenURLOptionsKey,id> *)options { return [RCTLinkingManager application:application openURL:url options:options]; } #end
React Native 0.66 iOS crashes on AppDelegate RCTRootView init
I'm trying to upgrade our RN project to 0.66 (from 0.63). When I build the project in debug mode, the app crashes on startup due to uncaught exception 'NSInvalidArgumentException', reason: '-[REAEventDispatcher setBridge:]: unrecognized selector sent to instance 0x600002f51cc0' when initializing the RCTRootView in the AppDelegate.m file (entire file at the end). After some googling, I found the unrecognized selector bit is because some function is undefined on an object. The error is marked in the code, its about halfway through the file. I need some help finding out why this function isn't available (or what else is wrong). As far as I can see, the files have an implementation of the functions that are called. Am I missing any imports? Not that well versed in Swift, only used it in combination with React Native. I haven't made a reproducible example, but I hope someone else has come over this already in porting to this version. If you need any more information, please ask. I've also attached the podfile below the relevant file. Appdelegate.m #import "AppDelegate.h" #import <React/RCTBridge.h> #import <React/RCTBundleURLProvider.h> #import <React/RCTRootView.h> #import <React/RCTLinkingManager.h> #import "RNBootSplash.h" #import <GoogleMaps/GoogleMaps.h> #import <UserNotifications/UserNotifications.h> #import <RNCPushNotificationIOS.h> #import <Firebase.h> #ifdef FB_SONARKIT_ENABLED #import <FlipperKit/FlipperClient.h> #import <FlipperKitLayoutPlugin/FlipperKitLayoutPlugin.h> #import <FlipperKitNetworkPlugin/FlipperKitNetworkPlugin.h> #import <FlipperKitReactPlugin/FlipperKitReactPlugin.h> #import <FlipperKitUserDefaultsPlugin/FKUserDefaultsPlugin.h> #import <SKIOSNetworkPlugin/SKIOSNetworkAdapter.h> static void InitializeFlipper(UIApplication *application) { FlipperClient *client = [FlipperClient sharedClient]; SKDescriptorMapper *layoutDescriptorMapper = [[SKDescriptorMapper alloc] initWithDefaults]; [client addPlugin:[[FlipperKitLayoutPlugin alloc] initWithRootNode:application withDescriptorMapper:layoutDescriptorMapper]]; [client addPlugin:[[FKUserDefaultsPlugin alloc] initWithSuiteName:nil]]; [client addPlugin:[FlipperKitReactPlugin new]]; [client addPlugin:[[FlipperKitNetworkPlugin alloc] initWithNetworkAdapter:[SKIOSNetworkAdapter new]]]; [client start]; } #endif #implementation AppDelegate - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { if([FIRApp defaultApp] == nil){ [FIRApp configure]; } [GMSServices provideAPIKey:#"AIzaSyC-BV0Dp46BQ1iP1HRws-oP_90FV0Aewfo"]; // add this line using the api key obtained from Google Console #ifdef FB_SONARKIT_ENABLED InitializeFlipper(application); #endif RCTBridge *bridge = [[RCTBridge alloc] initWithDelegate:self launchOptions:launchOptions] //This is where the application crashes RCTRootView *rootView = [[RCTRootView alloc] initWithBridge:bridge moduleName:#"Flatz" initialProperties:nil]; if (#available(iOS 13.0, *)) { rootView.backgroundColor = [UIColor systemBackgroundColor]; } else { rootView.backgroundColor = [[UIColor alloc] initWithRed:1.0f green:1.0f blue:1.0f alpha:1]; } self.window = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds]; UIViewController *rootViewController = [UIViewController new]; rootViewController.view = rootView; self.window.rootViewController = rootViewController; [self.window makeKeyAndVisible]; [RNBootSplash initWithStoryboard:#"LaunchScreen" rootView:rootView]; // <- initialization using the storyboard file name // Define UNUserNotificationCenter UNUserNotificationCenter *center = [UNUserNotificationCenter currentNotificationCenter]; center.delegate = self; return YES; } - (NSURL *)sourceURLForBridge:(RCTBridge *)bridge { #ifdef FB_SONARKIT_ENABLED return [[RCTBundleURLProvider sharedSettings] jsBundleURLForBundleRoot:#"index" fallbackResource:nil]; #else return [[NSBundle mainBundle] URLForResource:#"main" withExtension:#"jsbundle"]; #endif } // Required for the register event. - (void)application:(UIApplication *)application didRegisterForRemoteNotificationsWithDeviceToken:(NSData *)deviceToken { [RNCPushNotificationIOS didRegisterForRemoteNotificationsWithDeviceToken:deviceToken]; } // Required for the notification event. You must call the completion handler after handling the remote notification. - (void)application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo fetchCompletionHandler:(void (^)(UIBackgroundFetchResult))completionHandler { [RNCPushNotificationIOS didReceiveRemoteNotification:userInfo fetchCompletionHandler:completionHandler]; } // Required for the registrationError event. - (void)application:(UIApplication *)application didFailToRegisterForRemoteNotificationsWithError:(NSError *)error { [RNCPushNotificationIOS didFailToRegisterForRemoteNotificationsWithError:error]; } // Required for localNotification event - (void)userNotificationCenter:(UNUserNotificationCenter *)center didReceiveNotificationResponse:(UNNotificationResponse *)response withCompletionHandler:(void (^)(void))completionHandler { [RNCPushNotificationIOS didReceiveNotificationResponse:response]; } //Called when a notification is delivered to a foreground app. -(void)userNotificationCenter:(UNUserNotificationCenter *)center willPresentNotification:(UNNotification *)notification withCompletionHandler:(void (^)(UNNotificationPresentationOptions options))completionHandler { completionHandler(UNNotificationPresentationOptionSound | UNNotificationPresentationOptionAlert | UNNotificationPresentationOptionBadge); } - (BOOL)application:(UIApplication *)application openURL:(NSURL *)url options:(NSDictionary<UIApplicationOpenURLOptionsKey,id> *)options { return [RCTLinkingManager application:application openURL:url options:options]; } - (BOOL)application:(UIApplication *)application continueUserActivity:(nonnull NSUserActivity *)userActivity restorationHandler:(nonnull void (^)(NSArray<id<UIUserActivityRestoring>> * _Nullable))restorationHandler { return [RCTLinkingManager application:application continueUserActivity:userActivity restorationHandler:restorationHandler]; } #end 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, '11.0' target 'Flatz' do # No individual tracking of people or their phones $RNFirebaseAnalyticsWithoutAdIdSupport=true # React Native Maps dependencies rn_maps_path = '../node_modules/react-native-maps' pod 'react-native-google-maps', :path => rn_maps_path pod 'GoogleMaps' pod 'Google-Maps-iOS-Utils' config = use_native_modules! use_react_native!( :path => config["reactNativePath"], :hermes_enabled => true ) target 'FlatzTests' do inherit! :complete # Pods for testing end # Enables Flipper. # # Note that if you have use_frameworks! enabled, Flipper will not work and # you should disable these next few lines. use_flipper!({ 'Flipper-Folly' => '2.5.3', 'Flipper' => '0.87.0', 'Flipper-RSocket' => '1.3.1' }) post_install do |installer| installer.pods_project.targets.each do |target| target.build_configurations.each do |config| #1 deployment_target = config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] #2 target_components = deployment_target.split #3 if target_components.length > 0 #4 target_initial = target_components[0].to_i #5 if target_initial < 9 config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = "9.0" end end end end installer.pods_project.build_configurations.each do |config| config.build_settings["EXCLUDED_ARCHS[sdk=iphonesimulator*]"] = "arm64" end end permissions_path = '../node_modules/react-native-permissions/ios' pod 'Permission-Camera', :path => "#{permissions_path}/Camera" end
As jnpdx pointed out, I needed to follow the upgrade helper. Turns out there were quite a few steps I had missed doing it without it.
For me I had the iOS Deployment target under build settings on 9, while on the Podfile on 11. Changing to 11 solved the problem, see how to change iOS Deployment target. Also, remember to npx react-native-clean-project
iOS React Native Firebase (Invertase) Google Sign in build fails
I have been trying for sometime to get React Native Firebase Google Sign in work through the inverstase packages. I have followed the documentation in order that it is read and various other orders such as starting with the SDK https://rnfirebase.io/docs/v4.3.x/auth/social-auth#Google https://github.com/react-native-community/react-native-google-signin https://github.com/react-native-community/react-native-google-signin/blob/master/ios-guide.md My project setup looks like the following: Podfile # Uncomment the next line to define a global platform for your project # platform :ios, '9.0' target 'giftdrop' do ### GOOGLE MAPS ### rn_path = '../node_modules/react-native' rn_maps_path = '../node_modules/react-native-maps' # See http://facebook.github.io/react-native/docs/integration-with-existing-apps.html#configuring-cocoapods-dependencies pod 'yoga', path: "#{rn_path}/ReactCommon/yoga/yoga.podspec" pod 'React', path: rn_path, subspecs: [ 'Core', 'CxxBridge', 'DevSupport', 'RCTActionSheet', 'RCTAnimation', 'RCTGeolocation', 'RCTImage', 'RCTLinkingIOS', 'RCTNetwork', 'RCTSettings', 'RCTText', 'RCTVibration', 'RCTWebSocket', ] # React Native third party dependencies podspecs pod 'DoubleConversion', :podspec => "#{rn_path}/third-party-podspecs/DoubleConversion.podspec" pod 'glog', :podspec => "#{rn_path}/third-party-podspecs/glog.podspec" # If you are using React Native <0.54, you will get the following error: # "The name of the given podspec `GLog` doesn't match the expected one `glog`" # Use the following line instead: #pod 'GLog', :podspec => "#{rn_path}/third-party-podspecs/GLog.podspec" pod 'Folly', :podspec => "#{rn_path}/third-party-podspecs/Folly.podspec" # react-native-maps dependencies pod 'react-native-maps', path: rn_maps_path pod 'react-native-google-maps', path: rn_maps_path # Remove this line if you don't want to support GoogleMaps on iOS pod 'GoogleMaps' # Remove this line if you don't want to support GoogleMaps on iOS pod 'Google-Maps-iOS-Utils' # Remove this line if you don't want to support GoogleMaps on iOS ### FIREBASE ### pod 'Firebase/Core' pod 'Firebase/Firestore' pod 'Firebase/Auth' pod 'RNShare', :path => '../node_modules/react-native-share' pod 'Firebase/Messaging' pod 'react-native-version-number', :path => '../node_modules/react-native-version-number' pod 'GoogleSignIn' pod 'RNGoogleSignin', :path => '../node_modules/react-native-google-signin' end post_install do |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' end end if target.name == "React" target.remove_from_project end end end AppDelegate.m #import "AppDelegate.h" #import <Fabric/Fabric.h> #import <Crashlytics/Crashlytics.h> #import <React/RCTBundleURLProvider.h> #import <React/RCTRootView.h> #import <React/RCTLinkingManager.h> #import <Firebase.h> #import <React/RCTPushNotificationManager.h> // NPM module Notifications #import "RNFirebaseNotifications.h" // Firebase Notifications #import "RNFirebaseMessaging.h" // Firebase remote Notifications #import <FBSDKCoreKit/FBSDKCoreKit.h> #import "RNGoogleSignin.h" #import GoogleMaps; #implementation AppDelegate - (void)applicationDidBecomeActive:(UIApplication *)application { [FBSDKAppEvents activateApp]; } - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { [FIRApp configure]; [[FBSDKApplicationDelegate sharedInstance] application:application didFinishLaunchingWithOptions:launchOptions]; NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults]; if (![defaults boolForKey:#"notFirstRun"]) { [defaults setBool:YES forKey:#"notFirstRun"]; [defaults synchronize]; [[FIRAuth auth] signOut:NULL]; } [RNFirebaseNotifications configure]; // Firebase Notifications NSURL *jsCodeLocation; [GMSServices provideAPIKey:#"AIzaSyDLSohfIWoBOSmzpAHUqDSL-puku7LDP6U"]; jsCodeLocation = [[RCTBundleURLProvider sharedSettings] jsBundleURLForBundleRoot:#"index" fallbackResource:nil]; RCTRootView *rootView = [[RCTRootView alloc] initWithBundleURL:jsCodeLocation moduleName:#"giftdrop" initialProperties:nil launchOptions:launchOptions]; rootView.backgroundColor = [[UIColor alloc] initWithRed:1.0f green:1.0f blue:1.0f alpha:1]; self.window = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds]; UIViewController *rootViewController = [UIViewController new]; rootViewController.view = rootView; self.window.rootViewController = rootViewController; [self.window makeKeyAndVisible]; [Fabric with:#[[Crashlytics class]]]; return YES; } // deeplinking for fb and normal - (BOOL)application:(UIApplication *)application openURL:(NSURL *)url options:(NSDictionary<UIApplicationOpenURLOptionsKey,id> *)options sourceApplication:(NSString *)sourceApplication annotation:(id)annotation { BOOL handled = [[FBSDKApplicationDelegate sharedInstance] application:application openURL:url sourceApplication:sourceApplication annotation:annotation ] || [RNGoogleSignin application:application openURL:url sourceApplication:sourceApplication annotation:annotation ]; return handled || [RCTLinkingManager application:application openURL:url sourceApplication:sourceApplication annotation:annotation]; } // Required for the register event. - (void)application:(UIApplication *)application didRegisterForRemoteNotificationsWithDeviceToken:(NSData *)deviceToken { [RCTPushNotificationManager didRegisterForRemoteNotificationsWithDeviceToken:deviceToken]; } // Required for the registrationError event. - (void)application:(UIApplication *)application didFailToRegisterForRemoteNotificationsWithError:(NSError *)error { [RCTPushNotificationManager didFailToRegisterForRemoteNotificationsWithError:error]; } // Required for the localNotification event. - (void)application:(UIApplication *)application didReceiveLocalNotification:(UILocalNotification *)notification { [RCTPushNotificationManager didReceiveLocalNotification:notification]; } - (void)application:(UIApplication *)application didReceiveRemoteNotification:(nonnull NSDictionary *)userInfo fetchCompletionHandler:(nonnull void (^)(UIBackgroundFetchResult))completionHandler{ [[RNFirebaseNotifications instance] didReceiveRemoteNotification:userInfo fetchCompletionHandler:completionHandler]; } - (void)application:(UIApplication *)application didRegisterUserNotificationSettings:(UIUserNotificationSettings *)notificationSettings { [[RNFirebaseMessaging instance] didRegisterUserNotificationSettings:notificationSettings]; } #end Frameworks URL Types I changes the string out for security but I got it from GoogleInfo.plist REVERSED_CLIENT_ID Linked Libraries Framework Search Paths The string addition according to the docs, is added to both release and debug Firebase itself works fine, as does the Facebook SDK, but no matter how I do this my project fails to build with various errors depending on what order I do things. Most common is CFBundler error, duplicate libraries, sometimes no error at all just build failed Update Seems Xcode is reporting #import "RNGoogleSignin.h" not found
I had to manually link the project and its libraries to solve the issue, as seen in docs here https://github.com/react-native-community/react-native-google-signin Secondly I also had to set #import "RNGoogleSignin.h" as #import <GoogleSignIn/GoogleSignIn.h> which differs from the documentation.