Skip to content

IOS - RN 0.80.2 and RNN 8.2.1 RCT_NEW_ARCH_ENABLED - React-RuntimeApple/ReactCommon/RCTHost.h #8075

@ertugruldogan

Description

@ertugruldogan

node_modules/react-native-navigation/lib/ios/RNNReactButtonView.h:2:9
'React-RuntimeApple/ReactCommon/RCTHost.h' file not found

ENV['RCT_NEW_ARCH_ENABLED'] = '1' or ENV['RCT_NEW_ARCH_ENABLED'] = '0' It doesn't matter, the error is as above.

Podfile

ENV['RCT_NEW_ARCH_ENABLED'] = '1'

require Pod::Executable.execute_command('node', ['-p',
  'require.resolve(
    "react-native/scripts/react_native_pods.rb",
    {paths: [process.argv[1]]},
  )', __dir__]).strip

platform :ios, min_ios_version_supported
prepare_react_native_project!

$RNFirebaseAsStaticFramework = true
$RNFirebaseAnalyticsWithoutAdIdSupport = true

install! 'cocoapods', :deterministic_uuids => false

linkage = ENV['USE_FRAMEWORKS']
if linkage != nil
  Pod::UI.puts "Configuring Pod with #{linkage}ally linked Frameworks".green
  use_frameworks! :linkage => linkage.to_sym
else
  use_frameworks! :linkage => :static
end

target 'myapp' do
  config = use_native_modules!

  use_react_native!(
    :path => config[:reactNativePath],
    :app_path => "#{Pod::Config.instance.installation_root}/.."
  )

  pod 'Firebase/Core'
  pod 'Firebase/Messaging'
  pod 'Firebase/Analytics'
  
  pod 'FBSDKCoreKit'
  
  pod 'RNNotifee', :path => '../node_modules/@notifee/react-native'

  post_install do |installer|
    react_native_post_install(
      installer,
      config[:reactNativePath],
      :mac_catalyst_enabled => false
    )
    
    installer.pods_project.targets.each do |target|
      target.build_configurations.each do |config|
        config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = min_ios_version_supported
      end
    end
  end
end

AppDelegate.mm

#import "AppDelegate.h"
#import <Firebase.h>

// Notifee için gerekli import'lar
#import <UserNotifications/UserNotifications.h>
#if __has_include(<RNNotifee/RNNotifee.h>)
#import <RNNotifee/RNNotifee.h>
#define NOTIFEE_ENABLED 1
#else
#define NOTIFEE_ENABLED 0
#endif

#import <ReactNativeNavigation/ReactNativeNavigation.h>
#import <AuthenticationServices/AuthenticationServices.h>
#import <SafariServices/SafariServices.h>
#import <FBSDKCoreKit/FBSDKCoreKit-swift.h>
#import <React/RCTLinkingManager.h>
#import <React/RCTBridge.h>
#import <React/RCTBundleURLProvider.h>

@implementation AppDelegate

- (BOOL)application:(UIApplication *)app
            openURL:(NSURL *)url
            options:(NSDictionary<UIApplicationOpenURLOptionsKey,id> *)options {
    if ([[FBSDKApplicationDelegate sharedInstance] application:app openURL:url options:options]) {
        return YES;
    }
    
    if ([RCTLinkingManager application:app openURL:url options:options]) {
        return YES;
    }
    
    return NO;
}

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
    
    // Firebase initialize
    if ([FIRApp defaultApp] == nil) {
        [FIRApp configure];
    }
    
    // UNUserNotificationCenter delegate'ini ayarla - önemli!
    [UNUserNotificationCenter currentNotificationCenter].delegate = self;
    
    // React Native Navigation initialize
    RCTBridge *bridge = [[RCTBridge alloc] initWithDelegate:self launchOptions:launchOptions];
    [ReactNativeNavigation bootstrapWithBridge:bridge];
    
    // Badge sayısını sıfırla
    [UIApplication sharedApplication].applicationIconBadgeNumber = 0;
    
    return YES;
}

- (void)applicationDidBecomeActive:(UIApplication *)application {
    // Uygulama aktif olunca badge'i temizle
    [UIApplication sharedApplication].applicationIconBadgeNumber = 0;
}

- (BOOL)application:(UIApplication *)application continueUserActivity:(nonnull NSUserActivity *)userActivity
 restorationHandler:(nonnull void (^)(NSArray<id<UIUserActivityRestoring>> * _Nullable))restorationHandler {
    return [RCTLinkingManager application:application
                     continueUserActivity:userActivity
                       restorationHandler:restorationHandler];
}

- (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
}

#pragma mark - Remote Notifications

- (void)application:(UIApplication *)application didRegisterForRemoteNotificationsWithDeviceToken:(NSData *)deviceToken {
#if NOTIFEE_ENABLED
    // Notifee için device token'ı ayarla
    [[RNNotifee coreDelegate] didRegisterForRemoteNotificationsWithDeviceToken:deviceToken];
#endif
    
    // Firebase Messaging için APNS token'ı set et
    [FIRMessaging messaging].APNSToken = deviceToken;
}

- (void)application:(UIApplication *)application didFailToRegisterForRemoteNotificationsWithError:(NSError *)error {
    NSLog(@"Failed to register for remote notifications: %@", error);
}

- (void)application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo fetchCompletionHandler:(void (^)(UIBackgroundFetchResult))completionHandler {
#if NOTIFEE_ENABLED
    // Notifee için remote notification'ları handle et
    [[RNNotifee coreDelegate] didReceiveRemoteNotification:userInfo fetchCompletionHandler:completionHandler];
#else
    completionHandler(UIBackgroundFetchResultNewData);
#endif
}

#pragma mark - UNUserNotificationCenterDelegate

// Uygulama foreground'dayken notification geldiğinde
- (void)userNotificationCenter:(UNUserNotificationCenter *)center
       willPresentNotification:(UNNotification *)notification
         withCompletionHandler:(void (^)(UNNotificationPresentationOptions options))completionHandler {
    
#if NOTIFEE_ENABLED
    // Notifee'ye notification'ı bildir
    [[RNNotifee coreDelegate] userNotificationCenter:center willPresentNotification:notification withCompletionHandler:completionHandler];
#else
    // iOS 14+ için modern options
    if (@available(iOS 14.0, *)) {
        completionHandler(UNNotificationPresentationOptionSound | UNNotificationPresentationOptionBanner | UNNotificationPresentationOptionBadge);
    } else {
        completionHandler(UNNotificationPresentationOptionSound | UNNotificationPresentationOptionAlert | UNNotificationPresentationOptionBadge);
    }
#endif
}

// Kullanıcı notification'a tıkladığında
- (void)userNotificationCenter:(UNUserNotificationCenter *)center
didReceiveNotificationResponse:(UNNotificationResponse *)response
         withCompletionHandler:(void(^)())completionHandler {
    
#if NOTIFEE_ENABLED
    // Notifee'ye response'u bildir
    [[RNNotifee coreDelegate] userNotificationCenter:center didReceiveNotificationResponse:response withCompletionHandler:completionHandler];
#else
    completionHandler();
#endif
}

- (NSArray<id<RCTBridgeModule>> *)extraModulesForBridge:(RCTBridge *)bridge {
    return [ReactNativeNavigation extraModulesForBridge:bridge];
}

@end

AppDelegate.h

#import <React/RCTBridgeDelegate.h>
#import <UIKit/UIKit.h>
#import <UserNotifications/UserNotifications.h>

@interface AppDelegate : UIResponder <UIApplicationDelegate, RCTBridgeDelegate, UNUserNotificationCenterDelegate>

@property (nonatomic, strong) UIWindow *window;

@end

React Native Navigation version: 8.2.1
React Native version: 0.80.2
Has Fabric (React Native's new rendering system) enabled: (yes/no) = YES


Important

ENV['RCT_NEW_ARCH_ENABLED'] = '0'
React Native Navigation version: 7.45.0
React Native version: 0.80.2
Has Fabric (React Native's new rendering system) enabled: (yes/no) = NO
it works smoothly this way

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions