FB_SONARKIT_ENABLED=1 flag not working when initialising Flipper in iOS app (iOS NO APPLICATION SELECTED)

1.5k views Asked by At

I followed all the steps from:

https://fbflipper.com/docs/getting-started/react-native-ios/

(both automatic and manual installation).

FB_SONARKIT_ENABLED=1 doesn't seem to work.

Flipper connects to device but it is not initialised in the app and NO APPLICATION SELECTED error shows up.

enter image description here

Flag looks to be set OK:

enter image description here

RN: 0.66.4
Flipper: 0.144.0

Podfile:

require_relative '../node_modules/react-native/scripts/react_native_pods'
require_relative '../node_modules/@react-native-community/cli-platform-ios/native_modules'

platform :ios, '11.0'


target 'MYAPP' do
  permissions_path = '../node_modules/react-native-permissions/ios'
  config = use_native_modules!
  use_react_native!(
    :path => config[:reactNativePath],
    # to enable hermes on iOS, change `false` to `true` and then install pods
    :hermes_enabled => true
  )

  pod 'SwiftLint'
  
  target 'MYAPPTests' do
    inherit! :complete
    # Pods for testing
  end

  
  # Enables Flipper.
 
  use_flipper!({ 'Flipper' => '0.144.0' }, configurations: ['debug'])
end

post_install do |installer|
  flipper_post_install(installer)

  react_native_post_install(installer)
  __apply_Xcode_12_5_M1_post_install_workaround(installer)
  
  installer.pods_project.build_configurations.each do |config|
    config.build_settings["EXCLUDED_ARCHS[sdk=iphonesimulator*]"] = "arm64"
  end

  installer.pods_project.targets.each do |target|
    target.build_configurations.each do |config|
      config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = '11.0'
    end
  end
end

AppDelegate:

#if DEBUG
// #if FB_SONARKIT_ENABLED. <-- this has to be commented for Flipper to start
// otherwise Flipper is never imported and initialised, same for 
import FlipperKit
// #endif
#endif

@UIApplicationMain

  class AppDelegate: UIResponder, RCTBridgeDelegate, UIApplicationDelegate,
  UNUserNotificationCenterDelegate, RNAppAuthAuthorizationFlowManager {

  private func initializeFlipper(with application: UIApplication) {
    #if DEBUG
    //#if FB_SONARKIT_ENABLED // If this is not commented Flipper never starts.
    let client = FlipperClient.shared()
    let layoutDescriptorMapper = SKDescriptorMapper(defaults: ())

    // Notes: FlipperKitLayoutComponentKitSupport.setUpWith and 
    // client?.add(FlipperReactPerformancePlugin.sharedInstance()) need to be 
    // commented below for the build to work
    // FlipperKitLayoutComponentKitSupport.setUpWith(layoutDescriptorMapper)
    client?.add(FlipperKitLayoutPlugin(rootNode: application, with: layoutDescriptorMapper!))
    client?.add(FKUserDefaultsPlugin(suiteName: nil))
    client?.add(FlipperKitReactPlugin())
    client?.add(FlipperKitNetworkPlugin(networkAdapter: SKIOSNetworkAdapter()))
    // client?.add(FlipperReactPerformancePlugin.sharedInstance())
    client?.start()
    // #endif
    #endif
  }

Related questions:

https://github.com/facebook/flipper/issues/948

Note: I couldn't find anything about adding flag FB_SONARKIT_ENABLED to SWIFT_ACTIVE_COMPILATION_CONDITIONS (in Build settings for debug build) in Flipper docs.

0

There are 0 answers