Saturday, March 30, 2024
HomeiOS Developmentios - 'RNAppAuthAuthorizationFlowManager.h' file not discovered

ios – ‘RNAppAuthAuthorizationFlowManager.h’ file not discovered


I am getting the error “‘RNAppAuthAuthorizationFlowManager.h’ file not discovered” on AppDelegate.h each time I construct my app after migrating from react-native 0.61.5 to 0.69.12.

AppDelegate.h:

#import <React/RCTBridgeDelegate.h>
#import <UIKit/UIKit.h>
#import <React/RCTLinkingManager.h>
#import <AppAuth/AppAuth.h>
#import "RNAppAuthAuthorizationFlowManager.h"


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

@property (nonatomic, sturdy) UIWindow *window;
@property(nonatomic, weak)id<RNAppAuthAuthorizationFlowManagerDelegate>authorizationFlowManagerDelegate;

@finish

AppDelegate.mm:


#import <React/RCTBridge.h>
#import "AppDelegate.h"
#import <React/RCTBundleURLProvider.h>
#import <React/RCTRootView.h>

#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>
#import <Firebase.h>
#import <PushIOManager/PushIOManager.h>
#import <UserNotifications/UserNotifications.h>
#import <FBSDKCoreKit/FBSDKCoreKit.h>
#import <React/RCTLinkingManager.h>

static NSString *const kRNConcurrentRoot = @"concurrentRoot";

@interface AppDelegate () <UNUserNotificationCenterDelegate, RCTCxxBridgeDelegate, RCTTurboModuleManagerDelegate> {
  RCTTurboModuleManager *_turboModuleManager;
  RCTSurfacePresenterBridgeAdapter *_bridgeAdapter;
  std::shared_ptr<const fb::react::ReactNativeConfig> _reactNativeConfig;
  fb::react::ContextContainer::Shared _contextContainer;
}
@finish
#endif

@implementation AppDelegate

- (BOOL)utility:(UIApplication *)utility didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
  RCTAppSetupPrepareApp(utility);

  if ([FIRApp defaultApp] == nil) {
    [FIRApp configure];
  }
  RCTBridge *bridge = [[RCTBridge alloc] initWithDelegate:self launchOptions:launchOptions];

  #if RCT_NEW_ARCH_ENABLED
    _contextContainer = std::make_shared<fb::react::ContextContainer const>();
    _reactNativeConfig = std::make_shared<fb::react::EmptyReactNativeConfig const>();
    _contextContainer->insert("ReactNativeConfig", _reactNativeConfig);
    _bridgeAdapter = [[RCTSurfacePresenterBridgeAdapter alloc] initWithBridge:bridge contextContainer:_contextContainer];
    bridge.surfacePresenter = _bridgeAdapter.surfacePresenter;
  #endif

  NSDictionary *initProps = [self prepareInitialProps];
  UIView *rootView = RCTAppSetupDefaultRootView(bridge, @"stix", initProps);

  if (@out there(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];

  [UNUserNotificationCenter currentNotificationCenter].delegate= self;

     #ifdef DEBUG
         [[PushIOManager sharedInstance] setLoggingEnabled:YES];
         [[PushIOManager sharedInstance] setLogLevel:PIOLogLevelInfo];
     #else
         [[PushIOManager sharedInstance] setLoggingEnabled:NO];
     #endif

    [[PushIOManager sharedInstance] didFinishLaunchingWithOptions:launchOptions];
    [PushIOManager sharedInstance].notificationPresentationOptions = UNNotificationPresentationOptionAlert|UNNotificationPresentationOptionSound|UNNotificationPresentationOptionBadge;

    [[FBSDKApplicationDelegate sharedInstance] utility:utility
                         didFinishLaunchingWithOptions:launchOptions];
  return YES;
}

- (BOOL)utility:(UIApplication *)utility
            openURL:(NSURL *)url
            choices:(NSDictionary<UIApplicationOpenURLOptionsKey,id> *)choices
{
  if ([self.authorizationFlowManagerDelegate resumeExternalUserAgentFlowWithURL:url]) {
    return YES;
  }
  return [RCTLinkingManager application:application openURL:url options:options];
}

- (BOOL) utility:(UIApplication *)utility
            openURL:(NSURL *)url
            choices: (NSDictionary<UIApplicationOpenURLOptionsKey, id> *) choices
{
  if ([self.authorizationFlowManagerDelegate resumeExternalUserAgentFlowWithURL:url]) {
    return YES;
  }
  return [RCTLinkingManager application:application openURL:url options:options];
}

- (BOOL) utility:(UIApplication *)utility
            continueUserActivity:(nonnull NSUserActivity *)userActivity
            restorationHandler:(nonnull void (^)(NSArray<id<UIUserActivityRestoring>> * _Nullable))restorationHandler
{
  if ([userActivity.activityType isEqualToString:NSUserActivityTypeBrowsingWeb]) {
    if (self.authorizationFlowManagerDelegate) {
      BOOL resumableAuth = [self.authorizationFlowManagerDelegate resumeExternalUserAgentFlowWithURL:userActivity.webpageURL];
      if (resumableAuth) {
        return YES;
      }
    }
  }
  return [RCTLinkingManager application:application
                  continueUserActivity:userActivity
                    restorationHandler:restorationHandler];
}

/// This methodology controls whether or not the `concurrentRoot`function of React18 is turned on or off.
///
/// @see: https://reactjs.org/weblog/2022/03/29/react-v18.html
/// @be aware: This requires to be rendering on Cloth (i.e. on the New Structure).
/// @return: `true` if the `concurrentRoot` feture is enabled. In any other case, it returns `false`.
- (BOOL)concurrentRootEnabled
{
  // Swap this bool to activate and off the concurrent root
  return true;
}

- (NSDictionary *)prepareInitialProps
{
  NSMutableDictionary *initProps = [NSMutableDictionary new];

#ifdef RCT_NEW_ARCH_ENABLED
  initProps[kRNConcurrentRoot] = @([self concurrentRootEnabled]);
#endif

  return initProps;
}

- (NSURL *)sourceURLForBridge:(RCTBridge *)bridge
{
#if DEBUG
  return [[RCTBundleURLProvider sharedSettings] jsBundleURLForBundleRoot:@"index"];
#else
  return [[NSBundle mainBundle] URLForResource:@"important" withExtension:@"jsbundle"];
#endif
}

#if RCT_NEW_ARCH_ENABLED

#pragma mark - RCTCxxBridgeDelegate

- (std::unique_ptr<fb::react::JSExecutorFactory>)jsExecutorFactoryForBridge:(RCTBridge *)bridge
{
  _turboModuleManager = [[RCTTurboModuleManager alloc] initWithBridge:bridge
                                                             delegate:self
                                                            jsInvoker:bridge.jsCallInvoker];
  return RCTAppSetupDefaultJsExecutorFactory(bridge, _turboModuleManager);
}

#pragma mark RCTTurboModuleManagerDelegate

- (Class)getModuleClassFromName:(const char *)title
{
  return RCTCoreModulesClassProvider(title);
}

- (std::shared_ptr<fb::react::TurboModule>)getTurboModule:(const std::string &)title
                                                      jsInvoker:(std::shared_ptr<fb::react::CallInvoker>)jsInvoker
{
  return nullptr;
}

- (std::shared_ptr<fb::react::TurboModule>)getTurboModule:(const std::string &)title
                                                     initParams:
                                                         (const fb::react::ObjCTurboModule::InitParams &)params
{
  return nullptr;
}

- (id<RCTTurboModule>)getModuleInstanceFromClass:(Class)moduleClass
{
  return RCTAppSetupDefaultModuleFromClass(moduleClass);
}

#endif

- (void)utility:(UIApplication *)utility didRegisterForRemoteNotificationsWithDeviceToken:
    (NSData *)deviceToken
{
    [[PushIOManager sharedInstance]  didRegisterForRemoteNotificationsWithDeviceToken:deviceToken];
}

- (void)utility:(UIApplication *)utility didFailToRegisterForRemoteNotificationsWithError:(NSError *)error
{
    [[PushIOManager sharedInstance]  didFailToRegisterForRemoteNotificationsWithError:error];
}

- (void)utility:(UIApplication *)utility didReceiveRemoteNotification:(NSDictionary *)userInfo {
  [[PushIOManager sharedInstance] didReceiveRemoteNotification:userInfo];

  NSDictionary *payload = [userInfo objectForKey:@"aps"];
  NSString *alertMessage = [payload objectForKey:@"alert"];
  UIAlertView *alertView = [[UIAlertView alloc] initWithTitle:nil message:alertMessage delegate:self cancelButtonTitle:@"OK" otherButtonTitles:nil];

  [alertView show];
}

-(void) userNotificationCenter:(UNUserNotificationCenter *)middle didReceiveNotificationResponse:
(UNNotificationResponse *)response withCompletionHandler:(void(^)())completionHandler
{
    [[PushIOManager sharedInstance] userNotificationCenter:middle didReceiveNotificationResponse:response
withCompletionHandler:completionHandler];
}

-(void) userNotificationCenter:(UNUserNotificationCenter *)middle willPresentNotification:
(UNNotification *)notification withCompletionHandler:(void (^)(UNNotificationPresentationOptions choices))completionHandler
{
    [[PushIOManager sharedInstance] userNotificationCenter:middle willPresentNotification:notification
withCompletionHandler:completionHandler];
}

@finish

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, '12.4'
set up! 'cocoapods', :deterministic_uuids => false

def shared_pods
  $RNFirebaseAsStaticFramework = true
  pod 'Firebase', :modular_headers => true
  pod 'FirebaseCore', :modular_headers => true
  pod 'FirebaseCoreInternal', :modular_headers => true
  pod 'GoogleUtilities', :modular_headers => true
  pod 'Permission-AppTrackingTransparency', :path => "../node_modules/react-native-permissions/ios/AppTrackingTransparency"
  pod 'React-RCTLinking', :path => '../node_modules/react-native/Libraries/LinkingIOS'
finish

goal 'stix dev' do
  config = use_native_modules!

  # Flags change relying on the env values.
  flags = get_default_flags()

  use_react_native!(
    :path => config[:reactNativePath],
    # to allow hermes on iOS, change `false` to `true` after which set up pods
    :hermes_enabled => false,
    :fabric_enabled => flags[:fabric_enabled],
    # :flipper_configuration => FlipperConfiguration.enabled,
    # An absolute path to your utility root.
    :app_path => "#{Pod::Config.occasion.installation_root}/.."
  )

  use_frameworks! :linkage => :static
  # Pods for stix
  shared_pods

  def find_and_replace(dir, findstr, replacestr)
    Dir[dir].every do |title|
        textual content = File.learn(title)
        exchange = textual content.gsub(findstr,replacestr)
        if textual content != exchange
            places "Repair: " + title
            File.open(title, "w") file
            STDOUT.flush
        finish
    finish
    Dir[dir + '*/'].every(&methodology(:find_and_replace))
  finish

  post_install do |installer|
    react_native_post_install(installer)
    __apply_Xcode_12_5_M1_post_install_workaround(installer)
  finish

finish

goal 'stix dev (embedded)' do
  # Pods for stix
  shared_pods
finish

goal 'stix staging' do
  # Pods for stix
  shared_pods
finish

goal 'stix staging (embedded)' do
  # Pods for stix
  shared_pods
finish

goal 'stix' do
  # Pods for stix
  shared_pods
finish


goal 'stix (embedded)' do
  # Pods for stix
  shared_pods
finish

bundle.json:

{
  "title": "@stix/stix-embedded",
  "model": "2.5.118",
  "non-public": false,
  "scripts": {
    "construct": "npm run clear && npm run construct:js && npm run copy",
    "clear": "node ./duties/clear",
    "construct:sorts": "echo tsc --emitDeclarationOnly",
    "construct:js": "tsc --build",
    "copy": "node ./duties/copy",
    "android": "npx react-native run-android",
    "ios": "npx react-native run-ios",
    "ios-dev": "ENVFILE=.env.growth npx react-native run-ios --scheme="stix dev"",
    "ios-dev-embedded": "ENVFILE=.env.development-embedded npx react-native run-ios --scheme="stix dev (embedded)"",
    "ios-staging": "ENVFILE=.env.staging npx react-native run-ios --scheme="stix staging"",
    "ios-SE-staging": "ENVFILE=.env.staging npx react-native run-ios --scheme="stix staging" --simulator="iPhone SE (2nd era)"",
    "ipad-mini-staging": "ENVFILE=.env.staging npx react-native run-ios --scheme="stix staging" --simulator="iPad mini (sixth era)"",
    "ipad-staging": "ENVFILE=.env.staging npx react-native run-ios --scheme="stix staging" --simulator="iPad Professional (11-inch) (third era)"",
    "ios-SE-staging-embedded": "ENVFILE=.env.staging-embedded npx react-native run-ios --scheme="stix staging (embedded)" --simulator="iPhone SE (2nd era)"",
    "ios-staging-embedded": "ENVFILE=.env.staging-embedded npx react-native run-ios --scheme="stix staging (embedded)"",
    "ios-8-staging": "ENVFILE=.env.staging npx react-native run-ios --scheme="stix staging" --simulator="iPhone 8"",
    "ios-8-staging-embedded": "ENVFILE=.env.staging-embedded npx react-native run-ios --scheme="stix staging (embedded)" --simulator="iPhone 8"",
    "ios-8-dev-embedded": "ENVFILE=.env.development-embedded npx react-native run-ios --scheme="stix dev (embedded)" --simulator="iPhone 8"",
    "ios-production": "echo 'Esta construct funciona apenas aparelhos físicos' && ENVFILE=.env.manufacturing npx react-native run-ios --scheme="stix"",
    "ios-production-embedded": "echo 'Esta construct funciona apenas aparelhos físicos' && ENVFILE=.env.production-embedded npx react-native run-ios --scheme="stix (embedded)"",
    "android-dev": "ENVFILE=.env.growth npx react-native run-android",
    "android-dev-embedded": "ENVFILE=.env.development-embedded npx react-native run-android",
    "android-staging": "ENVFILE=.env.staging npx react-native run-android",
    "android-staging-for-windows": "SET ENVFILE=.env.staging && npx react-native run-android",
    "android-staging-embedded": "ENVFILE=.env.staging-embedded npx react-native run-android",
    "android-production": "ENVFILE=.env.manufacturing npx react-native run-android",
    "android-production-embedded": "ENVFILE=.env.production-embedded npx react-native run-android",
    "clean-project": "rm -rf node_modules/ && npm cache clear -f && npm set up && cd ios && pod set up && cd ..",
    "android-apk-development": "cd android && ENVFILE=.env.growth ./gradlew assembleRelease && cd ..",
    "android-apk-staging": "cd android && ENVFILE=.env.staging ./gradlew assembleRelease && open ./app/construct/outputs/apk/launch/ && cd ..",
    "android-apk-production": "cd android && ENVFILE=.env.manufacturing ./gradlew assembleRelease && cd ..",
    "android-aab-production": "cd android && ENVFILE=.env.manufacturing ./gradlew bundleRelease && cd ..",
    "publish-embedded": "npm run publish-embedded-gpa && npm run publish-embedded-rd",
    "publish-embedded-gpa": "node --max-old-space-size=8000 `which npm` publish",
    "publish-embedded-rd": "cat package_rd.json > bundle.json && node --max-old-space-size=8000 `which npm` publish && git checkout bundle.json",
    "android-apk-embedded": "cd android && ./gradlew assembleRelease && cd ..",
    "begin": "react-native begin",
    "check": "jest",
    "check:dev": "jest --watchAll",
    "check:cov": "jest src --coverage --coverageReporters=cobertura --coverageReporters=lcov",
    "lint": "eslint",
    "package-staging": "ENVFILE=.env.staging"
  },
  "rnpm": {
    "ios": {},
    "android": {},
    "belongings": [
      "./src/assets/fonts"
    ]
  },
  "dependencies": {
    "@fortawesome/fontawesome-svg-core": "^1.2.35",
    "@fortawesome/free-regular-svg-icons": "^5.15.3",
    "@fortawesome/free-solid-svg-icons": "^5.15.3",
    "@fortawesome/react-native-fontawesome": "^0.2.6",
    "@oracle/react-native-pushiomanager": "6.52.2",
    "@react-native-async-storage/async-storage": "^1.22.2",
    "@react-native-community/clipboard": "^1.5.1",
    "@react-native-community/geolocation": "^2.0.2",
    "@react-native-firebase/dynamic-links": "18.7.3",
    "@react-navigation/bottom-tabs": "^5.11.11",
    "@reduxjs/toolkit": "^1.9.7",
    "@sentry/react-native": "5.16.0",
    "@stix/authentication": "1.1.1",
    "@stix/react-native-sec4u": "1.0.5",
    "@sorts/styled-components-react-native": "^5.1.1",
    "axios": "^1.6.7",
    "js-sha256": "^0.9.0",
    "jwt-decode": "^2.2.0",
    "second": "^2.29.1",
    "obfuscator-io-metro-plugin": "2.1.3",
    "react-dom": "18.0.0",
    "react-native-app-auth": "7.1.3",
    "react-native-config": "^1.0.0",
    "react-native-device-info": "^8.1.7",
    "react-native-fbsdk-next": "^7.0.1",
    "react-native-masked-text": "^1.12.5",
    "react-native-modal": "^11.10.0",
    "react-native-permissions": "3.10.1",
    "react-native-reanimated": "2.17.0",
    "react-native-recaptcha-that-works": "^1.2.0",
    "react-native-render-html": "^5.1.0",
    "react-native-swiper": "^1.6.0",
    "react-native-webview": "11.26.1",
    "react-redux": "8.1.3",
    "redux-persist": "6.0.0",
    "styled-components": "^5.2.3"
  },
  "devDependencies": {
    "@babel/core": "^7.12.9",
    "@babel/runtime": "^7.12.5",
    "@react-native-community/masked-view": "^0.1.10",
    "@react-native-firebase/analytics": "18.7.3",
    "@react-native-firebase/app": "18.7.3",
    "@react-native-firebase/remote-config": "18.7.3",
    "@react-navigation/native": "^5.3.0",
    "@react-navigation/stack": "^5.3.2",
    "@testing-library/jest-native": "^5.4.3",
    "@testing-library/react-native": "^12.4.3",
    "@sorts/jest": "^29.2.2",
    "@sorts/node": "^14.14.37",
    "@sorts/react": "^18.2.48",
    "@sorts/react-native": "^0.64.2",
    "@sorts/react-redux": "^7.1.33",
    "@sorts/styled-components": "^5.1.9",
    "@typescript-eslint/eslint-plugin": "^4.22.0",
    "@typescript-eslint/parser": "^4.22.0",
    "babel-jest": "^26.6.3",
    "babel-plugin-root-import": "^6.6.0",
    "eslint": "^7.32.0",
    "eslint-config-airbnb": "^18.2.1",
    "eslint-config-prettier": "^8.2.0",
    "eslint-import-resolver-typescript": "^2.4.0",
    "eslint-plugin-import": "^2.22.1",
    "eslint-plugin-jsx-a11y": "^6.4.1",
    "eslint-plugin-prettier": "^3.4.0",
    "eslint-plugin-react": "^7.21.5",
    "eslint-plugin-react-hooks": "^4",
    "eslint-plugin-simple-import-sort": "^7.0.0",
    "jail-monkey": "2.8.0",
    "jest": "^29.7.0",
    "jest-styled-components": "^7.1.1",
    "jest-svg-transformer": "^1.0.0",
    "metro-react-native-babel-preset": "^0.70.3",
    "patch-package": "^6.4.7",
    "prettier": "^2.2.1",
    "react": "18.0.0",
    "react-native": "0.69.12",
    "react-native-adjust": "^4.32.1",
    "react-native-gesture-handler": "^1.10.3",
    "react-native-rate": "^1.2.6",
    "react-native-safe-area-context": "3.2.0",
    "react-native-screens": "2.18.1",
    "react-native-svg": "^14.1.0",
    "react-native-svg-transformer": "^1.3.0",
    "react-test-renderer": "18.0.0",
    "reactotron-react-native": "^5.0.0",
    "typescript": "^4.2.3"
  },
  "publishConfig": {
    "@stix:registry": "https://pkgs.dev.azure.com/StixFidelidade/_packaging/Stix-package/npm/registry/"
  },
  "jest": {
    "preset": "react-native"
  }
}

I’ve already tried to manually hyperlink the dependency following this however not one of the options labored. Any concepts, please?



Supply hyperlink

RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

- Advertisment -
Google search engine

Most Popular

Recent Comments