yamill/react-native-orientation

'Orientation.h' file not found

chenzhenrui opened this issue Β· 19 comments

'Orientation.h' file not found

Resolve path error report

$(SRCROOT)/node_modules/react-native-orientation/iOS/RCTOrientation
===>
$(SRCROOT)/../node_modules/react-native-orientation/iOS/RCTOrientation

any update on this

Had the same issue
cd ios
pod install
and it is solved

If you guys are using auto linking, you should use #import <Orientation.h> at the AppDelegate.m and ignore the manual configuration settings.

I'm having problems when i try to archive iOS to publish. it's saying that Orientation.h file not found.

I'm having problems when i try to archive iOS to publish. it's saying that Orientation.h file not found.

Greetings Juan,
Probably you are not using Pods, in which case you need to reference this way:

#import "Orientation.h"

Hope it helps.

Hi Bruno

i'm using React 0.62 that have Pods installed and autolink im trying with

#import "Orientation.h" and
#import <Orientation.h>

it compile but it doesn't archive for production.

Hi Juan!!

Please, provide the Xcode build output log.

@BrunoVillanova
Same case here with Juan

react-native: 0.62.2

npx pod-install

#import <Orientation.h>

But build error when archiving.
It's just saying "Use of undeclared identifier: 'Orientation'" in AppDelegate.m.
No other build logs.

Same issue here. Did you fixed it @seniordev32 ?

I found a way to get it working. I was finding weird the Debug build was completely fine, but this errors were only showing on the release version.

So I copied this line to the import section above #if DEBUGstatement, like this:

#import "AppDelegate.h"

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

#if DEBUG
#import <FlipperKit/FlipperClient.h>
#import <FlipperKitLayoutPlugin/FlipperKitLayoutPlugin.h>
#import <FlipperKitUserDefaultsPlugin/FKUserDefaultsPlugin.h>
#import <FlipperKitNetworkPlugin/FlipperKitNetworkPlugin.h>
#import <SKIOSNetworkPlugin/SKIOSNetworkAdapter.h>
#import <FlipperKitReactPlugin/FlipperKitReactPlugin.h>
#import "Orientation.h"
#import <GoogleMaps/GoogleMaps.h>

I wasn't so sure about changing the library, so I hope it helps

have you tested if this works with release builds also?

@BrunoVillanova yes, the statement #if DEBUG was preventing the app from executing the imports for the release version.

That's why the debug version was compiling with no issues.

@shuhikari I stuck here also. Which part you change? Could you add more details? Should I add this lines to top?

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

Guys already solved.

Just put your import #import "Orientation.h"
before the line #if DEBUG
That's the reason that doesn't work when Archive.

Like this.

#import "AppDelegate.h"

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

#if DEBUG
#import <FlipperKit/FlipperClient.h>
#import <FlipperKitLayoutPlugin/FlipperKitLayoutPlugin.h>
#import <FlipperKitUserDefaultsPlugin/FKUserDefaultsPlugin.h>
#import <FlipperKitNetworkPlugin/FlipperKitNetworkPlugin.h>
#import <SKIOSNetworkPlugin/SKIOSNetworkAdapter.h>
#import <FlipperKitReactPlugin/FlipperKitReactPlugin.h>
#import "Orientation.h"
#import <GoogleMaps/GoogleMaps.h>

Guys already solved.

Just put your import #import "Orientation.h"
before the line #if DEBUG
That's the reason that doesn't work when Archive.

Like this.

#import "AppDelegate.h"

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

#if DEBUG
#import <FlipperKit/FlipperClient.h>
#import <FlipperKitLayoutPlugin/FlipperKitLayoutPlugin.h>
#import <FlipperKitUserDefaultsPlugin/FKUserDefaultsPlugin.h>
#import <FlipperKitNetworkPlugin/FlipperKitNetworkPlugin.h>
#import <SKIOSNetworkPlugin/SKIOSNetworkAdapter.h>
#import <FlipperKitReactPlugin/FlipperKitReactPlugin.h>
#import "Orientation.h"
#import <GoogleMaps/GoogleMaps.h>

Juan,

Please check your package.json dependency version, mine is:

` "react-native-orientation": "^3.1.3"

In AppDelegate.m header:

#import <Orientation.h>

Install pod with npx pod-install and you are good to go.

For me putting
#import <Orientation.h>

before
#if defined(FB_SONARKIT_ENABLED) && __has_include(<FlipperKit/FlipperClient.h>) statement in AppDelegate.m

worked

#import "Orientation.h" to the top of file AppDelegate.m

worked for me
To add the path to the Orientation header file in Xcode, follow these steps:

1.Open your Xcode project.

2.Select your project in the file navigator to open the project settings.

3.Go to the "Build Settings" tab.

4.Search for "Header Search Paths" in the search bar.

5.Double-click on the value column for the "Header Search Paths" setting.

6.A popover window will appear. Click on the "+" button to add a new search path.

7.In the new row, enter the path to the Orientation header file. The path should be something like $(SRCROOT)/../node_modules/react-native-orientation-locker/ios.

Make sure the path is set to "recursive" (marked as "Yes").

9.Close the popover window by clicking outside of it or pressing Enter.

10.Clean and rebuild your project by going to the "Product" menu and selecting "Clean Build Folder." Then, rebuild your project by selecting "Product" and "Build" (or use the Cmd+B shortcut).

By adding the search path, Xcode should be able to locate the Orientation header file from the react-native-orientation-locker library. The "'Orientation/Orientation.h' file not found" error should be resolved.

If you are using a different path or facing any other issues, please provide more details, including your Xcode version and any specific error messages you encounter, so that I can assist you further.