question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[iOS] use_framework!

See original GitHub issue

I’m trying to install the flipper pod in a repository where swift pods are added to the project using the use_framework! option.

Unfortunately, this triggers an error that prevents the installation from completing successfully.

[!] The 'Pods-ProjectName' target has transitive dependencies that include static binaries: 
(/path/to/Pods/CocoaLibEvent/lib/libevent.a,
/path/to/Pods/CocoaLibEvent/lib/libevent_core.a, 
/path/to/Pods/CocoaLibEvent/lib/libevent_extra.a,
/path/to/Pods/CocoaLibEvent/lib/libevent_pthreads.a,
/path/to/Pods/OpenSSL-Static/lib-ios/libcrypto.a, and
/path/to/Pods/OpenSSL-Static/lib-ios/libssl.a)

I cannot remove that option for some reasons. The most important one is a bug in Cocoapods https://github.com/CocoaPods/CocoaPods/issues/7585

Since all the involved pods come from flipper, Is there something that we can do about it?

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:2
  • Comments:12 (4 by maintainers)

github_iconTop GitHub Comments

3reactions
priteshrnandgaonkarcommented, May 3, 2019

I tried the following

  $static_framework = ['FlipperKit', 'Flipper', 'Flipper-Folly',
    'CocoaAsyncSocket', 'ComponentKit', 'DoubleConversion',
    'glog', 'Flipper-PeerTalk', 'Flipper-RSocket', 'Yoga', 'YogaKit',
    'CocoaLibEvent', 'OpenSSL-Static', '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)
        pod.instance_variable_set(:@host_requires_frameworks, false)
        puts pod
      end
    end
  end

It successfully generated the project and even the sample app built.

CocoaPods version 1.6.1

Try it out and feel free to open the issue, if it didn’t work.

2reactions
davidmcraejrcommented, Dec 19, 2018

Ok after playing around some more I have included this code in my Podfile and this works -

$static_framework = ['FlipperKit', 'Flipper', 'Folly', 
    'CocoaAsyncSocket', 'ComponentKit', 'DoubleConversion', 
    'glog', 'PeerTalk', 'RSocket', 'Yoga', 'YogaKit', 
    'CocoaLibEvent', 'OpenSSL-Static', 'boost-for-react-native']
pre_install do |installer|
    installer.pod_targets.each do |pod|
        if $static_framework.include?(pod.name)
            pod.host_requires_frameworks = false
        end
    end
end

This will cause Pods to build the pods in the array as static and the others dynamic frameworks

Read more comments on GitHub >

github_iconTop Results From Across the Web

Why do we use use_frameworks! in CocoaPods?
use_frameworks! tells CocoaPods that you want to use Frameworks instead of Static Libraries. Since Swift does not support Static Libraries you have to...
Read more >
Flipper integration with cocoapod use_frameworks ... - GitHub
I want to use Flipper in a project that have mix of swift and objective c. I followed all the steps mentioned in...
Read more >
Link Firebase dependencies statically or dynamically - Google
Beginning with CocoaPods 1.9.0 and Firebase 7, you can choose whether your Firebase dependencies are built as static or dynamic frameworks.
Read more >
Mixing static and dynamic linking in CocoaPods - Medium
By default, CocoaPods will build pods as static libraries and the use_frameworks! attribute can be used to configure all pods in a target...
Read more >
Technical Note TN2435: Embedding Frameworks In An App
This tech note is for app developers on macOS, iOS, watchOS, and tvOS who are modularizing their code into frameworks.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found