react-native-exit-app: iOS build problem

Hello,

I am facing a problem with iOS build. Currenlty I am using RN 0.73.2 and I need to build the app with static framework, so I am not 100% sure what the problem could be (if the newest Rn release or the static framework) anyway I got this error in RNExitApp.h

‘React-Codegen/RNExitAppSpec/RNExitAppSpec.h’ file not found` at line 10

#import <React-Codegen/RNExitAppSpec/RNExitAppSpec.h> 

The error disappear (and I am able to build my app) if I change the line to #import <RNExitAppSpec/RNExitAppSpec.h> so probably it is just necessary to update the code.

I can open PR if you want.

Thanks

About this issue

  • Original URL
  • State: open
  • Created 3 years ago
  • Reactions: 4
  • Comments: 26

Commits related to this issue

Most upvoted comments

@VimukthiShohan

--- a/node_modules/react-native-exit-app/ios/RNExitApp/RNExitApp.h
+++ b/node_modules/react-native-exit-app/ios/RNExitApp/RNExitApp.h
@@ -1,13 +1,13 @@
 #if __has_include(<React/RCTBridgeModule.h>)
 #import <React/RCTBridgeModule.h>
-#elif __has_include("RCTBridgeModule.h")
-#import "RCTBridgeModule.h"
+#elif __has_include(<React/RCTBridgeModule.h>)
+#import <React/RCTBridgeModule.h>
 #else
-#import "React/RCTBridgeModule.h"
+#import <React/RCTBridgeModule.h>
 #endif
 
 #if RCT_NEW_ARCH_ENABLED
-#import <React-Codegen/RNExitAppSpec/RNExitAppSpec.h>
+#import <ReactCodegen/RNExitAppSpec/RNExitAppSpec.h>
 #endif
 
 @interface RNExitApp : NSObject <RCTBridgeModule>

You can run that patch.

from: import <React-Codegen/RNExitAppSpec/RNExitAppSpec.h>

to: import <ReactCodegen/RNExitAppSpec/RNExitAppSpec.h>

Facing the same issue on RN new architecture

going from .75 to .78 … patch does not help, still getting “file not found” on #import <ReactCodegen/RNExitAppSpec/RNExitAppSpec.h>

Incase you need to patch RNExitApp.m as well:

diff --git a/node_modules/react-native-exit-app/ios/RNExitApp/RNExitApp.h b/node_modules/react-native-exit-app/ios/RNExitApp/RNExitApp.h
index 50a2135..4a598a3 100644
--- a/node_modules/react-native-exit-app/ios/RNExitApp/RNExitApp.h
+++ b/node_modules/react-native-exit-app/ios/RNExitApp/RNExitApp.h
@@ -7,7 +7,7 @@
 #endif
 
 #if RCT_NEW_ARCH_ENABLED
-#import <React-Codegen/RNExitAppSpec/RNExitAppSpec.h>
+#import <ReactCodegen/RNExitAppSpec/RNExitAppSpec.h>
 #endif
 
 @interface RNExitApp : NSObject <RCTBridgeModule>
diff --git a/node_modules/react-native-exit-app/ios/RNExitApp/RNExitApp.mm b/node_modules/react-native-exit-app/ios/RNExitApp/RNExitApp.mm
index bec5948..f2a8743 100644
--- a/node_modules/react-native-exit-app/ios/RNExitApp/RNExitApp.mm
+++ b/node_modules/react-native-exit-app/ios/RNExitApp/RNExitApp.mm
@@ -3,7 +3,7 @@
 #import "RNExitApp.h"
 
 #if RCT_NEW_ARCH_ENABLED
-#import <RNExitAppSpec/RNExitAppSpec.h>
+#import <ReactCodegen/RNExitAppSpec/RNExitAppSpec.h>
 #endif
 
 @implementation RNExitApp

Same issue here with:

react-native version: ^0.79.1 react-native-exit-app: 2.0.0

the patch is not working in this version 😦 any solutions?

@VimukthiShohan

--- a/node_modules/react-native-exit-app/ios/RNExitApp/RNExitApp.h
+++ b/node_modules/react-native-exit-app/ios/RNExitApp/RNExitApp.h
@@ -1,13 +1,13 @@
 #if __has_include(<React/RCTBridgeModule.h>)
 #import <React/RCTBridgeModule.h>
-#elif __has_include("RCTBridgeModule.h")
-#import "RCTBridgeModule.h"
+#elif __has_include(<React/RCTBridgeModule.h>)
+#import <React/RCTBridgeModule.h>
 #else
-#import "React/RCTBridgeModule.h"
+#import <React/RCTBridgeModule.h>
 #endif
 
 #if RCT_NEW_ARCH_ENABLED
-#import <React-Codegen/RNExitAppSpec/RNExitAppSpec.h>
+#import <ReactCodegen/RNExitAppSpec/RNExitAppSpec.h>
 #endif
 
 @interface RNExitApp : NSObject <RCTBridgeModule>

You can run that patch.

from: import <React-Codegen/RNExitAppSpec/RNExitAppSpec.h>

to: import <ReactCodegen/RNExitAppSpec/RNExitAppSpec.h>

Am on React-Native 0.76.5 and this patch works

For RN 0.77.2

Any patch on the above is not working. The following error still happened:

node_modules/react-native-exit-app/ios/RNExitApp/RNExitApp.h:10:9:
'ReactCodegen/RNExitAppSpec/RNExitAppSpec.h' file not found

@peteAhn I’m on 0.77.2 as well, the patch below works for me

`diff --git a/node_modules/react-native-exit-app/ios/RNExitApp/RNExitApp.h b/node_modules/react-native-exit-app/ios/RNExitApp/RNExitApp.h index 50a2135…572fa91 100644 — a/node_modules/react-native-exit-app/ios/RNExitApp/RNExitApp.h +++ b/node_modules/react-native-exit-app/ios/RNExitApp/RNExitApp.h @@ -7,7 +7,7 @@ #endif

#if RCT_NEW_ARCH_ENABLED -#import <React-Codegen/RNExitAppSpec/RNExitAppSpec.h> +#import “RNExitAppSpec.h” #endif

@interface RNExitApp : NSObject <RCTBridgeModule> diff --git a/node_modules/react-native-exit-app/ios/RNExitApp/RNExitApp.mm b/node_modules/react-native-exit-app/ios/RNExitApp/RNExitApp.mm index bec5948…020c05a 100644 — a/node_modules/react-native-exit-app/ios/RNExitApp/RNExitApp.mm +++ b/node_modules/react-native-exit-app/ios/RNExitApp/RNExitApp.mm @@ -3,7 +3,7 @@ #import “RNExitApp.h”

#if RCT_NEW_ARCH_ENABLED -#import <RNExitAppSpec/RNExitAppSpec.h> +#import “RNExitAppSpec.h” #endif

@implementation RNExitApp `

For RN 0.79.1 i generated a patch

open RNExitApp.h and add replace import under RCT_NEW_ARCH_ENABLED with

#if RCT_NEW_ARCH_ENABLED
#import <ReactCodegen/RNExitAppSpec/RNExitAppSpec.h>
#endif

open RNExitApp.mm and replace the import under #if RCT_NEW_ARCH_ENABLED with

#if RCT_NEW_ARCH_ENABLED
#import <RNExitApp/RNExitApp.h>
#endif

then run npx patch-package react-native-exit-app yarn install again or npm install then go to ios folder and run pod install again

Hello everyone,

I have also been facing this error. If anyone could provide more information.

react-native version: ^0.79.1 react-native-exit-app: 2.0.0.

The error that I have been receiving 'ReactCodegen/RNExitAppSpec/RNExitAppSpec.h' file not found on this line #import <ReactCodegen/RNExitAppSpec/RNExitAppSpec.h>.

Not working in 0.79.1 with patch. Is anyone maintaining this lib?

@dkahdwk Thanks for the help. Ran in to some errors and fixed by this flow. I will keep it if someone get this issue.

Patch is applied.

'RNExitAppSpec/RNExitAppSpec.h' file not found

Screenshot 2024-11-25 at 16 08 01

And I have replace manually pod file import. After doing that it gives following error.

5 duplicate symbols

Screenshot 2024-11-25 at 16 16 11

Solution from above error ⬇️

I found this on Apple forum. I hope this would be helpful for anyone who still facing the issue. Fixed: Add “-ld64” under Build Setting -> Other Linker Flags

https://forums.developer.apple.com/forums/thread/736590 https://developer.apple.com/forums/thread/731090

✅ Solution In React Native 0.76+, the New Architecture is enabled by default.

  • Disable New Architecture by adding this at the top of your Podfile:

ENV[‘RCT_NEW_ARCH_ENABLED’] = ‘0’

cd ios && pod install --repo-update

I hope this works, thanks.

Incase you need to patch RNExitApp.m as well:

diff --git a/node_modules/react-native-exit-app/ios/RNExitApp/RNExitApp.h b/node_modules/react-native-exit-app/ios/RNExitApp/RNExitApp.h index 50a2135…4a598a3 100644 — a/node_modules/react-native-exit-app/ios/RNExitApp/RNExitApp.h +++ b/node_modules/react-native-exit-app/ios/RNExitApp/RNExitApp.h @@ -7,7 +7,7 @@ #endif

#if RCT_NEW_ARCH_ENABLED -#import <React-Codegen/RNExitAppSpec/RNExitAppSpec.h> +#import <ReactCodegen/RNExitAppSpec/RNExitAppSpec.h> #endif

@interface RNExitApp : NSObject <RCTBridgeModule> diff --git a/node_modules/react-native-exit-app/ios/RNExitApp/RNExitApp.mm b/node_modules/react-native-exit-app/ios/RNExitApp/RNExitApp.mm index bec5948…f2a8743 100644 — a/node_modules/react-native-exit-app/ios/RNExitApp/RNExitApp.mm +++ b/node_modules/react-native-exit-app/ios/RNExitApp/RNExitApp.mm @@ -3,7 +3,7 @@ #import “RNExitApp.h”

#if RCT_NEW_ARCH_ENABLED -#import <RNExitAppSpec/RNExitAppSpec.h> +#import <ReactCodegen/RNExitAppSpec/RNExitAppSpec.h> #endif

@implementation RNExitApp

Mmm is the changes to RNExitApp.mm required for the fix? I recognize and tested the RNExitApp.h part without the RNExitApp.mm

Well for some reason it never worked for me without patching .m file. Xcode complained about not able to find this package.