launchdarkly/react-native-client-sdk

Getting Error Right After Installation

Closed this issue · 7 comments

Hi, my company is interested in using launch darkly. I tried to install it today for React Native.
I followed your documentation here:
https://docs.launchdarkly.com/sdk/client-side/react/react-native#getting-started

It was pretty simple.
Describe the bug
Right after I installed the package and then pods and ran my application and tried to build it I got the following error:

node_modules/launchdarkly-react-native-client-sdk/ios/LaunchdarklyReactNativeClient-Bridging-Header.h:5:9: include of non-modular header inside framework module 'launchdarkly_react_native_client_sdk.LaunchdarklyReactNativeClient_Bridging_Header': '/Users/nata/Desktop/MobileApp/ios/Pods/Headers/Public/React-Core/React/RCTBridge.h'

#import <React/RCTBridge.h>

I've tried so much to resolve it, but nothing seems to work.

what I did to install it is the following:
npm install --save launchdarkly-react-native-client-sdk && cd ios && npx pod install

I also tried pod install --repo-update

I also tried pod deintegrate && pod install

Is this issue somehow related to one of your issues?
#166 and could it be caused by react native version - we are almost using the latest one.
We are using 0.70.6 version of react native, so automatically the latest react native SDK was installed
"launchdarkly-react-native-client-sdk": "^7.1.1",

Pods installed successfully:

  - LaunchDarkly (8.0.0):
    - LaunchDarkly/Core (= 8.0.0)
  - launchdarkly-react-native-client-sdk (7.1.1):
    - LaunchDarkly (= 8.0.0)
    - React-Core
  - LaunchDarkly/Core (8.0.0):
    - LDSwiftEventSource (= 3.0.0)
  - LDSwiftEventSource (3.0.0) 

Our application is running just fine without launchdarkly, but with it, it doesn't seem to run.
Our minimum deployment target on iOS is 12.4, therefore I think we meet all the requirements for the latest SDK installation.

Let me know if anyone else has had this issue or how we could resolve it.

We do have different targets for our application (Development, Production) - not sure if this could mess with it, but later I tried including

target 'MobileAppDev' do
  pod 'LaunchDarkly', '~> 8.0'
end

for a specific target of ours and it also did not work.

SDK version
7.1.1

OS/platform
iPhone 13 with iOS 15.2

Please try the following:

  1. Run the hello-react-native app. This app uses the latest 7.1.1 LaunchDarkly React Native SDK and React Native 0.70.7. I have verified that this works.
  2. Something that may be useful for you in the repo above is the clean-all.sh script. You can try using that in your project.
  3. There is a separate ManualTestApp in the sdk repo which you can try and run as well. This should also work and it uses the latest 7.1.1 LaunchDarkly React Native SDK and React Native 0.71.3.

Failing these, we'll need to take a look at your setup and source code in more detail. Please contact our support team for further assistance.

Thanks, I'll try the clean-all.sh script and will let you know how it works out

I ran the clean-all.sh script but it didn't help, I am still getting the same errors for iOS.

It works fine on android.

I've found that I could install launch darkly on a completely new app and run ios and android with the same version of react native that I mentioned above. Therefore, now I know that it is not because of the react native version that we have. However, when building from the ios app xcode I get this error
/Users/nata/Desktop/MobileApp/ios/MobileApp/AppDelegate.h:1:9: 'React/RCTBridgeDelegate.h' file not found

and when building from command line I get these errors

/Users/nata/Desktop/MobileApp/node_modules/launchdarkly-react-native-client-sdk/ios/LaunchdarklyReactNativeClient-Bridging-Header.h:5:9: include of non-modular header inside framework module 'launchdarkly_react_native_client_sdk.LaunchdarklyReactNativeClient_Bridging_Header': '/Users/nata/Desktop/MobileApp/ios/Pods/Headers/Public/React-Core/React/RCTBridge.h'

#import <React/RCTBridge.h>
        ^



❌  /Users/nata/Desktop/MobileApp/node_modules/launchdarkly-react-native-client-sdk/ios/LaunchdarklyReactNativeClient-Bridging-Header.h:6:9: include of non-modular header inside framework module 'launchdarkly_react_native_client_sdk.LaunchdarklyReactNativeClient_Bridging_Header': '/Users/nata/Desktop/MobileApp/ios/Pods/Headers/Public/React-Core/React/RCTBridgeModule.h'

#import <React/RCTBridgeModule.h>
        ^



❌  /Users/nata/Desktop/MobileApp/node_modules/launchdarkly-react-native-client-sdk/ios/LaunchdarklyReactNativeClient-Bridging-Header.h:7:9: include of non-modular header inside framework module 'launchdarkly_react_native_client_sdk.LaunchdarklyReactNativeClient_Bridging_Header': '/Users/nata/Desktop/MobileApp/ios/Pods/Headers/Public/React-Core/React/RCTEventDispatcher.h'

#import <React/RCTEventDispatcher.h>
        ^



❌  /Users/nata/Desktop/MobileApp/node_modules/launchdarkly-react-native-client-sdk/ios/LaunchdarklyReactNativeClient-Bridging-Header.h:8:9: include of non-modular header inside framework module 'launchdarkly_react_native_client_sdk.LaunchdarklyReactNativeClient_Bridging_Header': '/Users/nata/Desktop/MobileApp/ios/Pods/Headers/Public/React-Core/React/RCTEventEmitter.h'

#import <React/RCTEventEmitter.h>
        ^



❌  /Users/nata/Desktop/MobileApp/node_modules/launchdarkly-react-native-client-sdk/ios/LaunchdarklyReactNativeClient-Bridging-Header.h:9:9: include of non-modular header inside framework module 'launchdarkly_react_native_client_sdk.LaunchdarklyReactNativeClient_Bridging_Header': '/Users/nata/Desktop/MobileApp/ios/Pods/Headers/Public/React-Core/React/RCTConvert.h'

#import <React/RCTConvert.h>

I also found another issue on your github from 2019 when react native I think was still using linking, but not sure how it was resolved in the end and if it could help me or not #14

Any directions would be appreciated

To continue the discussion, was the ManualTestApp that is in a directory of this SDK work on your environment? We are trying to understand if is there something general with your environment (as we have automated and manual tests that ensure the ManualTestApp should run with the latest 0.70 RN version) or your project.

  • We are currently experiencing issues setting up OUR mobile application to work with the LaunchDarkly package and pods.

  • We have successfully used LaunchDarkly with other applications including the example applications provided by your team whether it is ManualTestApp or hello-react-native-app. Therefore it is not some generic issue connected to our local setup, it is an issue with our application working with launch darkly.

We do have a specific multitarget application setup for ios and android. For android, the project is running fine with launch darkly included, however, on ios right after installation the project will not run.

In the above messages, I have included specific errors that we are getting.

  • I have also mentioned two github issues opened on your react native SDK client repository created before that might somehow be connected to our issue. Those issues also do not have a specific resolution in the conversation and I am just interested in how you resolved those issues for your customers and if it could be connected to our application as well so that we could try the same steps and maybe resolve the issues we are getting for our company's application.

  • If we are unable to resolve this issue, it will prevent us from using LaunchDarkly for our company.

  • We have not received specific steps to resolve the issue beyond running example applications or clearing caches.
    Again, example applications are running fine and working fine and clearing caches did not help.

We would greatly appreciate any additional help you could provide to resolve this issue directly for our application. All the details about our specific problem are in the conversation above.

So far, we've received very vague responses on how to resolve this issue. Perhaps we could schedule a call with one of your tech team members to troubleshoot the errors we encounter during the installation and running of our application, or maybe someone from your tech team could take a look at the errors we are getting above and provide some specific steps to take other than cleaning cache or running example apps.

Alternatively, if there are any solutions that have worked for the related GitHub issues mentioned in the above messages, we'd be glad to try those out as well!
(#14 & #166)

Hi, I see you also have a support ticket open with us as well. We'll close this issue and help you via your support ticket. If this turns out to be a bug then we can involve the engineering team again.

I tried my best to resolve the issue with the stack overflow link that was sent over to us
https://stackoverflow.com/questions/56916798/react-rctbridgedelegate-h-file-not-found

Unfortunately, the suggestions here did not work. I've been trying the whole day today. The fixes included in the above stack overflow link were mostly for M1 Chip Macbooks, and mine is based on the Intel Chip. I did try to resolve the issues with the rest of the suggestions, but those tries did not go well either.
I just want to once more summarize what we've gone through so far and what issues we're facing, because our company really wants to use Launch Darkly, but we need to get this SDK working for us. 

Facts 

  • Our application works fine without Launch Darkly Setup. Still, right after installing Launch Darkly with existing documentation, the app does not build only for iOS - Android works fine - this means that we successfully went through the installation process, but something went wrong when building pods. It even connected to existing flags and fetched information correctly for Android. 

  • We are using multi-target deployment, which I think might be messing with your SDK. However, many large companies are using this, so I'd be interested in how they might have resolved it. If anyone has had similar issues, please suggest us some of the fixes that might have worked for them.

As mentioned before in the thread I've found some issues that people have had with your framework that might be connected to ours, could you please look into the support tickets for those as well, and maybe you can find any suggestion that could help us?

#14
#13
#166

List of Solutions We've Tried to Resolve Errors Given Below

❌  /Users/nata/Desktop/MobileApp/node_modules/launchdarkly-react-native-client-sdk/ios/LaunchdarklyReactNativeClient-Bridging-Header.h:5:9: include of non-modular header inside framework module 'launchdarkly_react_native_client_sdk.LaunchdarklyReactNativeClient_Bridging_Header': '/Users/nata/Desktop/MobileApp/ios/Pods/Headers/Public/React-Core/React/RCTBridge.h'
#import <React/RCTBridge.h>
        ^
❌  /Users/nata/Desktop/MobileApp/node_modules/launchdarkly-react-native-client-sdk/ios/LaunchdarklyReactNativeClient-Bridging-Header.h:6:9: include of non-modular header inside framework module 'launchdarkly_react_native_client_sdk.LaunchdarklyReactNativeClient_Bridging_Header': '/Users/nata/Desktop/MobileApp/ios/Pods/Headers/Public/React-Core/React/RCTBridgeModule.h'
#import <React/RCTBridgeModule.h>
        ^
❌  /Users/nata/Desktop/MobileApp/node_modules/launchdarkly-react-native-client-sdk/ios/LaunchdarklyReactNativeClient-Bridging-Header.h:7:9: include of non-modular header inside framework module 'launchdarkly_react_native_client_sdk.LaunchdarklyReactNativeClient_Bridging_Header': '/Users/nata/Desktop/MobileApp/ios/Pods/Headers/Public/React-Core/React/RCTEventDispatcher.h'
#import <React/RCTEventDispatcher.h>
        ^
❌  /Users/nata/Desktop/MobileApp/node_modules/launchdarkly-react-native-client-sdk/ios/LaunchdarklyReactNativeClient-Bridging-Header.h:8:9: include of non-modular header inside framework module 'launchdarkly_react_native_client_sdk.LaunchdarklyReactNativeClient_Bridging_Header': '/Users/nata/Desktop/MobileApp/ios/Pods/Headers/Public/React-Core/React/RCTEventEmitter.h'
#import <React/RCTEventEmitter.h>
        ^
❌  /Users/nata/Desktop/MobileApp/node_modules/launchdarkly-react-native-client-sdk/ios/LaunchdarklyReactNativeClient-Bridging-Header.h:9:9: include of non-modular header inside framework module 'launchdarkly_react_native_client_sdk.LaunchdarklyReactNativeClient_Bridging_Header': '/Users/nata/Desktop/MobileApp/ios/Pods/Headers/Public/React-Core/React/RCTConvert.h'
#import <React/RCTConvert.h> 
  • Getting rid of caches by the suggested clean-all.sh file provided by your team & reinstalling pods

  • Cleaning Caches through the Xcode project, deleting build folders, podfile.lock, trying to update pods with repo-update command

For each of the following points, I cleaned the project builds & reinstalled the pods & reran the app. I did all of the steps separately and in combination as well.

  • Including headers that technically should be missing according to the errors that the terminal is providing. I included the paths to those headers inside Build Settings > Header Search Paths for each target
  • Adding a script to allow non-modular includes in framework modules
installer.pods_project.targets.each do |target|
  target.build_configurations.each do |config|
    target.build_settings(config.name)['CLANG_ALLOW_NON_MODULAR_INCLUDES_IN_FRAMEWORK_MODULES'] = 'YES'
  end
end
  • Allowing Non-modular includes in framework modules for each of our targets through Xcode settings without the script, but by modifying changes (Build Settings > Allow Non-Modular includes in framework)

  • Setting Defines Module to Yes for every target of our application

  • Including All frameworks and modules related to Launch Darkly inside General > Frameworks, Libraries, and Embedded Content. This gave me a different error, which I thought was progress, but I still could not resolve that issue and I am not even sure this was an appropriate step to take, because at this point I am desperately trying to look for solutions and trying to do anything connected to this issue that I've read about from StackOverflow. For this solution the only error I got is below, the rest seemed resolved (but not very sure about that)

/Users/nata/Desktop/MobileApp/ios/Pods/Headers/Public/launchdarkly_react_native_client_sdk/launchdarkly-react-native-client-sdk-library-umbrella.h:13:9: 'LaunchdarklyReactNativeClient-Bridging-Header.h' file not found
#import "LaunchdarklyReactNativeClient-Bridging-Header.h"

There is not much information out there for errors such as this. We are trying to look for solutions because we want to use Launch Darkly, but having a setback here is a huge show-stopper for us.

Here's information about my local environment:

  • macOS Ventura 13.2.1
  • Intel Chip
  • Xcode - 14.2

Here is our Podfile, just in case you find anything that we're doing that would mess up our connection with your SDK.

# Convert all permission pods into static libraries
pre_install do |installer|
  Pod::Installer::Xcode::TargetValidator.send(:define_method, :verify_no_static_framework_transitive_dependencies) {}

  installer.pod_targets.each do |pod|
    if pod.name.eql?('RNPermissions') || pod.name.start_with?('Permission-')
      def pod.build_type;
        # Uncomment the line corresponding to your CocoaPods version
        Pod::BuildType.static_library # >= 1.9
        # Pod::Target::BuildType.static_library # < 1.9
      end
    end
  end
end

$RNFirebaseAsStaticFramework = true

# Override Firebase SDK Version
$FirebaseSDKVersion = '10.3.0'

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

pod 'Firebase', :modular_headers => true
pod 'FirebaseCoreInternal', :modular_headers => true
pod 'GoogleUtilities', :modular_headers => true

production = ENV["PRODUCTION"] == "1"

abstract_target 'operixCommonPods' do
  config = use_native_modules!

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

  use_react_native!(
    :path => config[:reactNativePath],
    # to enable hermes on iOS, change `false` to `true` and then install pods
    :production => production,
    :hermes_enabled => flags[:hermes_enabled],
    :fabric_enabled => flags[:fabric_enabled],
    # An absolute path to your application root.
    :app_path => "#{Pod::Config.instance.installation_root}/.."
  )

  def shared_pods
    permissions_path = '../node_modules/react-native-permissions/ios'
    pod 'Permission-Camera', :path => "#{permissions_path}/Camera"
    pod 'Permission-MediaLibrary', :path => "#{permissions_path}/MediaLibrary"
    pod 'Permission-PhotoLibrary', :path => "#{permissions_path}/PhotoLibrary"
    pod 'RNFBApp', :path => '../node_modules/@react-native-firebase/app'
    use_frameworks! :linkage => :static
  end

  target 'MobileAppDev' do
    shared_pods
  end

  target 'MobileAppOperixProd' do
    shared_pods
  end

  target 'MobileAppSageProd' do
      shared_pods
  end

  target 'MobileAppTests' do
    inherit! :complete
    # Pods for testing
  end

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

Here's our package.json file

{
  "name": "mobileapp",
  "version": "0.0.1",
  "private": true,
  "scripts": {
    "android": "react-native run-android",
    "ios": "react-native run-ios",
    "start": "react-native start",
    "test": "jest",
  },
  "dependencies": {
    "@fortawesome/fontawesome-pro": "^6.2.1",
    "@fortawesome/fontawesome-svg-core": "^6.2.0",
    "@fortawesome/pro-duotone-svg-icons": "^6.2.1",
    "@fortawesome/pro-light-svg-icons": "^6.2.1",
    "@fortawesome/pro-regular-svg-icons": "^6.2.1",
    "@fortawesome/pro-solid-svg-icons": "^6.2.1",
    "@fortawesome/pro-thin-svg-icons": "^6.2.1",
    "@fortawesome/react-native-fontawesome": "^0.3.0",
    "@fortawesome/sharp-solid-svg-icons": "^6.2.1",
    "@react-native-async-storage/async-storage": "^1.17.10",
    "@react-native-clipboard/clipboard": "^1.11.1",
    "@react-native-community/datetimepicker": "^6.5.2",
    "@react-native-community/netinfo": "^9.3.7",
    "@react-native-firebase/analytics": "^17.3.2",
    "@react-native-firebase/app": "^17.3.2",
    "@react-native-firebase/crashlytics": "^17.3.2",
    "@react-navigation/drawer": "^6.4.2",
    "@react-navigation/native": "^6.0.10",
    "@react-navigation/native-stack": "^6.6.2",
    "@react-navigation/stack": "^6.2.1",
    "@reduxjs/toolkit": "^1.8.2",
    "axios": "^0.27.2",
    "crypto-js": "3.1.9-1",
    "launchdarkly-react-native-client-sdk": "^7.1.1",
    "moment": "^2.29.4",
    "native-base": "^3.4.13",
    "prop-types": "^15.8.1",
    "react": "^18.1.0",
    "react-dom": "^18.1.0",
    "react-native": "^0.70.6",
    "react-native-actions-sheet": "^0.8.10",
    "react-native-background-timer": "^2.4.1",
    "react-native-config": "^1.4.6",
    "react-native-device-info": "^9.0.2",
    "react-native-element-dropdown": "^2.3.0",
    "react-native-gesture-handler": "^2.4.2",
    "react-native-image-crop-picker": "^0.39.0",
    "react-native-image-viewing": "^0.2.2",
    "react-native-linear-gradient": "^2.6.2",
    "react-native-modal-datetime-picker": "^14.0.0",
    "react-native-multitap": "^0.0.5",
    "react-native-offline": "^6.0.0",
    "react-native-permissions": "^3.6.1",
    "react-native-reanimated": "^2.12.0",
    "react-native-safe-area-context": "^3.3.2",
    "react-native-screens": "^3.13.1",
    "react-native-signature-capture": "^0.4.12",
    "react-native-svg": "^12.4.4",
    "react-native-uuid": "^2.0.1",
    "react-redux": "^8.0.2",
    "redux": "^4.2.0",
    "redux-logger": "^3.0.6",
    "redux-persist": "^6.0.0"
  },
  "devDependencies": {
    "@babel/core": "^7.12.9",
    "@babel/runtime": "^7.12.5",
    "@react-native-community/eslint-config": "^2.0.0",
    "babel-jest": "^26.6.3",
    "eslint": "^7.32.0",
    "jest": "^26.6.3",
    "metro-react-native-babel-preset": "^0.70.3",
    "react-test-renderer": "^18.1.0"
  },
  "jest": {
    "preset": "react-native"
  }
}