react-native-exit-app icon indicating copy to clipboard operation
react-native-exit-app copied to clipboard

[iOS] Invariant Violation: TurboModuleRegistry.getEnforcing(...): 'RNExitApp' could not be found

Open taekeun-two opened this issue 2 years ago • 2 comments

Hi, I faced the following error in iOS, but Android works well. Does autolink work with ReactNative 0.72.6 ?

Invariant Violation: TurboModuleRegistry.getEnforcing(...): 'RNExitApp' could not be found.
Verify that a module by this name is registered in the native binary., js engine: hermes
Invariant Violation: "main" has not been registered. This can happen if:
* Metro (the local dev server) is run from the wrong folder. Check if Metro is running, stop it and
restart it in the current project.
* A module failed to load due to an error and `AppRegistry.registerComponent` wasn't called., js
engine: hermes
 ERROR  Invariant Violation: TurboModuleRegistry.getEnforcing(...): 'RNExitApp' could not be found. Verify that a module by this name is registered in the native binary., js engine: hermes
 ERROR  Invariant Violation: "main" has not been registered. This can happen if:
* A module failed to load due to an error and `AppRegistry.registerComponent` wasn't called., js engine: hermes

image

Environment

Expo bare workflow

    "react-native": "0.72.6",
    "react": "18.2.0",
    "expo": "^49.0.0",
    "react-native-exit-app": "^2.0.0",

didn't follow manual link yet. (I don't know exactly how to do this.)

Add RNExitApp.xcoderproj into your project in the Libraries folder.
Add the .a file on the General tab of your target under Linked Frameworks And Libraries
Add the .a file on the Build Phases tab of your target under Link Binary With Libraries

taekeun-two avatar Dec 18 '23 01:12 taekeun-two

@taekeun-two faced with the same problem, just check if you reinstall pods with cd ios && pod install. Also you can try to clean your build folder and remove project cache in DerivedData folder. It works for me.

donutdonate avatar Dec 19 '23 15:12 donutdonate

@donutdonate For my case, this problem occurs even using fresh repository just after cloning again.

taekeun-two avatar Dec 20 '23 02:12 taekeun-two

I don't know the reason, but recently this error dissappers. 🙏

As I mentioned, I didn't know how to do the following...

Add RNExitApp.xcoderproj into your project in the Libraries folder.
Add the .a file on the General tab of your target under Linked Frameworks And Libraries
Add the .a file on the Build Phases tab of your target under Link Binary With Libraries

In the following link, I could a little bit understand what am I supposed to do, so that I just share it.

https://github.com/dylanngo95/react-native-close-app?tab=readme-ov-file#ios

In XCode, in the project navigator, right click Libraries ➜ Add Files to [your project's name]
Go to node_modules ➜ react-native-close-app and add RNCloseApp.xcodeproj
In XCode, in the project navigator, select your project. Add libRNCloseApp.a to your project's Build Phases ➜ Link Binary With Libraries
Run your project (Cmd+R)<
In XCode, in the project navigator, right click
Libraries ➜ Add Files to [your project's name]
Go to node_modules ➜ react-native-close-app
and add RNCloseApp.xcodeproj
In XCode, in the project navigator, select your project.
Add libRNCloseApp.a to your project's
Build Phases ➜ Link Binary With Libraries
Run your project (Cmd+R)<

taekeun-two avatar Feb 02 '24 07:02 taekeun-two