Sitemap

Fixing “”Use of undeclared identifier ‘ReactNativeConfig” error

Oct 11, 2023

--

It seemed easy, but it wasn’t obvious how to fix this error. It was about a renamed config file though.

Press enter or click to view image in full size

If you ever encountered this error, or “ReactNativeConfig/ReactNativeConfig.h’ file not found error after trying to import it in your AppDelegate.m file, all you need to do it a renaming operation.

  1. Use `#import “RNCConfig.h”` instead of the old import statement (#import ReactNativeConfig/ReactNativeConfig.h)
  2. When you attempt to read the env variable, use `RNCConfig envFor` instead of `ReactNativeConfig envFor`.
    Example: `NSString *mapsApiKey = [RNCConfig envFor:@”GOOGLE_MAPS_API_KEY”];`

That’s all.

--

--

Serdar Cevher
Serdar Cevher

Written by Serdar Cevher

Developer of web & mobile apps | Co-founder: Off2Class, Auglinn | Founder: SmarDish, tarifmotoru.com, valizim.com | Ex columnist @PCnetDergisi

Responses (2)