Flipper: Question: FlipperKit header files not found

Created on 5 Jul 2019  路  12Comments  路  Source: facebook/flipper

Trying to follow the getting started for iOS from the website, I always end up with this error.
'FBDefines/FBDefines.h' file not found when trying to build my project in XCode.
The file is in this repository but not in my locally built pod.
I am using use_frameworks! and uncommented everything related.

I tried versions 0.22.0 and 0.21.1
Swift 5

Any ideas what I am doing wrong?

Most helpful comment

Hey, the solution proposed by @priteshrnandgaonkar didn't work, please reopen @passy

In the podfile it is written:
Note that if you have use_frameworks! enabled, Flipper will not work....

How are we supposed to get it working with use_frameworks ?

All 12 comments

This might have to do something with header/framework search paths.
So if someone has a working Swift example with . use_frameworks!, that would probably help.

I have used the changes from this comment: https://github.com/facebook/flipper/issues/254#issuecomment-504405955 which fixed static linking for OpenSSL.

Looking at the headers generated by CocoaPods, FBDefines/FBDefines.h is actually in FlipperKit/FBDefines.h - if I change this, the error goes away but other missing headers appear.

I would really appreciate some input on how to get Flipper to work or if this is even supported.
The changes from https://github.com/facebook/flipper/issues/254#issuecomment-504405955 are also missing from the documentation.

For me more headers are not found, this is quite frustrating that flipper is not working with use_frameworks! :/

For CP 1.7+ with use_framework!, the following worked for me

  $static_framework = ['FlipperKit', 'Flipper', 'Flipper-Folly',
    'CocoaAsyncSocket', 'ComponentKit', 'DoubleConversion',
    'glog', 'Flipper-PeerTalk', 'Flipper-RSocket', 'Yoga', 'YogaKit',
    'CocoaLibEvent', 'openssl-ios-bitcode', 'boost-for-react-native']

  pre_install do |installer|
    Pod::Installer::Xcode::TargetValidator.send(:define_method, :verify_no_static_framework_transitive_dependencies) {}
    installer.pod_targets.each do |pod|
        if $static_framework.include?(pod.name)
          def pod.build_type;
            Pod::Target::BuildType.static_library
          end
        end
      end
  end

Will update the sample and docs soon.

@kuhnroyal and @felislynx-silae can you try the above solution.

@priteshrnandgaonkar It looks it helped, but build time is very long. Maybe putting some things like boost for react as optional might help

I got further with this change but can't import FlipperClient and FlipperKitLayoutPlugin when following the setup.

        let client = FlipperClient.shared()
        let layoutDescriptorMapper = SKDescriptorMapper(defaults: ())
        FlipperKitLayoutComponentKitSupport.setUpWith(layoutDescriptorMapper)
        client?.add(FlipperKitLayoutPlugin(rootNode: application, with: layoutDescriptorMapper!))
        client?.start()

I'm cleaning up some old issues and this one hasn't seen updates in a long time. Please let me know if this is still a problem and we can reopen it. Thanks!

Hey, the solution proposed by @priteshrnandgaonkar didn't work, please reopen @passy

In the podfile it is written:
Note that if you have use_frameworks! enabled, Flipper will not work....

How are we supposed to get it working with use_frameworks ?

For anyone finding this in the future... Flipper does now document how to define Pods whilst using use_frameworks: https://fbflipper.com/docs/getting-started/ios-native/

project 'MyApp.xcodeproj'
flipperkit_version = '0.49.0'

target 'MyApp' do
  platform :ios, '9.0'

  # .......

  # If you use `use_frameworks!` in your Podfile,
  # uncomment the below $static_framework array and also
  # the pre_install section.  This will cause Flipper and
  # it's dependencies to be built as a static library and all other pods to
  # be dynamic.
  #
  # NOTE Doing this may lead to a broken build if any of these are also
  #      transitive dependencies of other dependencies and are expected
  #      to be built as frameworks.
  #
  # $static_framework = ['FlipperKit', 'Flipper', 'Flipper-Folly',
  #   'CocoaAsyncSocket', 'ComponentKit', 'Flipper-DoubleConversion',
  #   'Flipper-Glog', 'Flipper-PeerTalk', 'Flipper-RSocket', 'Yoga', 'YogaKit',
  #   'CocoaLibEvent', 'OpenSSL-Universal', 'boost-for-react-native']
  #
  # pre_install do |installer|
  #   Pod::Installer::Xcode::TargetValidator.send(:define_method, :verify_no_static_framework_transitive_dependencies) {}
  #   installer.pod_targets.each do |pod|
  #       if $static_framework.include?(pod.name)
  #         def pod.build_type;
  #           Pod::BuildType.static_library
  #         end
  #       end
  #     end
  # end
end

For anyone finding this in the future... Flipper does now document how to define Pods whilst using use_frameworks: https://fbflipper.com/docs/getting-started/ios-native/

project 'MyApp.xcodeproj'
flipperkit_version = '0.49.0'

target 'MyApp' do
  platform :ios, '9.0'

  # .......

  # If you use `use_frameworks!` in your Podfile,
  # uncomment the below $static_framework array and also
  # the pre_install section.  This will cause Flipper and
  # it's dependencies to be built as a static library and all other pods to
  # be dynamic.
  #
  # NOTE Doing this may lead to a broken build if any of these are also
  #      transitive dependencies of other dependencies and are expected
  #      to be built as frameworks.
  #
  # $static_framework = ['FlipperKit', 'Flipper', 'Flipper-Folly',
  #   'CocoaAsyncSocket', 'ComponentKit', 'Flipper-DoubleConversion',
  #   'Flipper-Glog', 'Flipper-PeerTalk', 'Flipper-RSocket', 'Yoga', 'YogaKit',
  #   'CocoaLibEvent', 'OpenSSL-Universal', 'boost-for-react-native']
  #
  # pre_install do |installer|
  #   Pod::Installer::Xcode::TargetValidator.send(:define_method, :verify_no_static_framework_transitive_dependencies) {}
  #   installer.pod_targets.each do |pod|
  #       if $static_framework.include?(pod.name)
  #         def pod.build_type;
  #           Pod::BuildType.static_library
  #         end
  #       end
  #     end
  # end
end

What about react native?

Was this page helpful?
0 / 5 - 0 ratings