FB_SONARKIT_ENABLED = 1在iOS应用中初始化flipper时不起作用(iOS未选择应用程序)

发布于 2025-01-26 22:34:36 字数 3703 浏览 3 评论 0原文

我遵循以下步骤:

https://fbflipper.com/docs/docs/启动/react-native-ios/

(自动安装和手动安装)。

fb_sonarkit_enabled = 1似乎不起作用

flipper连接到设备,但在应用程序中没有初始化的应用程序错误显示错误。

标志看起来要设置好

“在此处输入图像描述”

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
  }

相关问题:

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

注意:我找不到任何内容添加标志fb_sonarkit_enabledswift_active_compilation_conditions(在flipper doc中为调试构建的构建设置中)。

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.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文