How to debug networking react native ios with firebase
Asked Answered
B

2

5

I using react-native version 0.72.5 and @react-native-firebase/app 18.

when I config in Podfile, I add use_frameworks! :linkage => :static and comment

# :hermes_enabled => flags[:hermes_enabled],
# :fabric_enabled => flags[:fabric_enabled],
# :flipper_configuration => flipper_config,

I cannot use react-native-debugger and can only use flipper but networking is unavailable. How to debug it?

enter image description here

Bussy answered 16/10, 2023 at 15:34 Comment(0)
A
1

Looks like the flipper_configuration => flipper_config does some changes related to the Network Plugin Setup. You will need to add it manually, as follows:

To your podfile, add this:

pod 'FlipperKit/SKIOSNetworkPlugin', '~>' + flipperkit_version

Then, initialize the plugin, by adding into your AppDelegate.m:

If it uses Objective-C:

#import <FlipperKitNetworkPlugin/FlipperKitNetworkPlugin.h>

[[FlipperClient sharedClient] addPlugin: [[FlipperKitNetworkPlugin alloc] initWithNetworkAdapter:[SKIOSNetworkAdapter new]]];

If it uses Swift:

import FlipperKit

client?.add(FlipperKitNetworkPlugin(networkAdapter: SKIOSNetworkAdapter()))

This should work for IOS.

You can read more about it and how to do it on Android on this page on the docs.

Albertalberta answered 9/11, 2023 at 19:55 Comment(2)
What is flipperkit_version? I tried with the current version on my mac which is 0.236.0 but there is a warning when pod install is: CocoaPods could not find compatible versions for pod "FlipperKit/SKIOSNetworkPlugin": In Podfile: FlipperKit/SKIOSNetworkPlugin (~> 0.236.0)Bussy
i tried the documentation here but it doesn't workBussy
T
0
  use_react_native!(
    :path => config[:reactNativePath],
    :hermes_enabled => true,
    # :fabric_enabled => flags[:fabric_enabled],
    :fabric_enabled => false,
    :flipper_configuration => FlipperConfiguration.enabled(["Debug"], { 'Flipper' => '0.163.0' }),
    :app_path => "#{Pod::Config.instance.installation_root}/.."
  )
  pod 'Firebase', :modular_headers => true
  pod 'FirebaseCore', :modular_headers => true
  pod 'FirebaseCoreExtension', :modular_headers => true
  pod 'FirebaseInstallations', :modular_headers => true
  pod 'GoogleDataTransport', :modular_headers => true
  pod 'nanopb', :modular_headers => true
  pod 'FirebaseSessions', :modular_headers => true
  pod 'FirebaseCoreInternal', :modular_headers => true
  pod 'GoogleUtilities', :modular_headers => true
  pod 'Firebase/Messaging', :modular_headers => true
  pod 'Firebase/Analytics', :modular_headers => true

My podfile config, hope this help you

Theadora answered 14/11, 2023 at 2:33 Comment(1)
I'm pod install success, but when I build it ERROR: 'FlipperKit/FlipperClient.h' file not foundBussy

© 2022 - 2024 — McMap. All rights reserved.