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.

Why are there no dynamic framework targets for React Native?

See original GitHub issue

Description

React Native has only static library targets. Any reason why there are no dynamic framework targets as well?

screen shot 2016-12-07 at 12 00 28

I understand why this was done from the start, as RN supported iOS 7 (and possibly below) at some point, but since the project now has a deployment target of iOS 8, there really is nothing to prevent dynamic frameworks on the surface. Any underlying technical issues in supporting it?

Adding dynamic framework targets will finally allow stopping the HEADER_SEARCH_PATHS hell of sub-projects. Working with Swift projects will also be much simpler.

Solution

There are two solutions I can think of; add dynamic frameworks targets directly and include all source files there, all headers in the headers phase. Or, create a dynamic framework wrapper that links with the static libs, but still exposes the headers in a headers phase. The former is more elegant, but the latter can be a little bit less work to maintain.

Additional Information

  • React Native version: Latest git source as of 2016-12-7.
  • Platform: iOS
  • Operating System: MacOS/Xcode

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Reactions:20
  • Comments:13 (9 by maintainers)

github_iconTop GitHub Comments

4reactions
hramoscommented, Jun 29, 2018

Hi there! This issue is being closed because it has been inactive for a while. Maybe the issue has been fixed in a recent release, or perhaps it is not affecting a lot of people. Either way, we’re automatically closing issues after a period of inactivity. Please do not take it personally!

If you think this issue should definitely remain open, please let us know. The following information is helpful when it comes to determining if the issue should be re-opened:

  • Does the issue still reproduce on the latest release candidate? Post a comment with the version you tested.
  • If so, is there any information missing from the bug report? Post a comment with all the information required by the issue template.
  • Is there a pull request that addresses this issue? Post a comment with the PR number so we can follow up.

If you would like to work on a patch to fix the issue, contributions are very welcome! Read through the contribution guide, and feel free to hop into #react-native if you need help planning your contribution.

2reactions
LeoNatancommented, May 16, 2017

@kanekin Yes, it is possible. You create a dynamic framework target, link the static framework, and add -ObjC -all_load to your OTHER_LDFLAGS (other linker flags). As for exposing the headers, you can either manually add the static framework headers to the dynamic framework’s Copy Headers Phase, or write a script that exports them as expected. The former is seemingly easier, but becomes maintenance hell if your static framework is actively changing (as is the case with React Native).

Read more comments on GitHub >

github_iconTop Results From Across the Web

Dynamic libraries not linked after updating to React Native ...
5 I am having problems linking libraries that can be linked only dynamically ( @react-native-mapbox-gl/maps ). The solution would normally be to ...
Read more >
Problems building a new react-native project in Xcode
I open the project again in Xcode and delete from 'frameworks, libraries and emebedded content' all the libraries so that only the JavaScriptCore.framework...
Read more >
Flutter vs React Native: Which is Best for Your App? [2022]
Planning to create an app? Check out our Flutter vs React Native guide that will help you consider which is the best fit...
Read more >
Design Principles
This document assumes a strong understanding of React. It describes the design principles of React itself, not React components or applications.
Read more >
How to add React Native to an existing iOS app in 2022
The Podfile given in the guides for adding React Native to an existing iOS project will not work! I repeat that. Their Podfile...
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