-
Notifications
You must be signed in to change notification settings - Fork 333
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Added static lib support for cocoapods #968
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There should probably be additions to the readme about anything extra people might need to do or want to do to get static vs. dynamic.
Co-authored-by: LRubin <sanscontext@users.noreply.github.com>
@sanscontext @bsneed with our app that uses our internal library will get this error, why are we making Segment as a static framework? |
@migs647 any idea to work around the error? |
@fangmobile can you see if these options work for you? https://guides.cocoapods.org/syntax/podfile.html#use_frameworks_bang |
@bsneed thanks Cons: Since it is statically loaded App core memory usage is higher. App load time might be affected as well. There are some extra steps to do involving multiple copies of files produced by Cocoapods scripts. Pros? any thoughts are appreciated. |
Being statically linked, the app load time will be shorter. As for memory usage, that should be lower as well as there's no overhead of the frameworks. If you're seeing a memory difference it could be because some frameworks are being lazy loaded, but if they are being used, they'll get loaded eventually. Apple's had a few sessions that go over the benefits of static linking vs. dynamic, namely that they optimize the system such that performance is still good at, I think they said 4?? dynamic frameworks, and more than that it drops precipitously. YMMV though. This article covers some of it as well as links to the WWDC sessions on the subject: https://medium.com/ios-expert-series-or-interview-series/ios-app-launch-static-binding-vs-dynamic-binding-linking-vs-embedded-e69ea9f03f72 I was thinking if you set the :linkage to be dynamic, it would override what we're setting, but not sure without checking. |
I'm seeing similar to @fangmobile where we have an internal CocoaPod and this change forces the Segment framework to be built as a static framework so we get transitive dependency errors. |
What does this PR do?
Added the capability for the pod to be built as a static framework
Where should the reviewer start?
Test with Swift and Objective-C. It may be appropriate to use
use_modular_headers!
oruse_frameworks! :linkage => :static
in the PodfileHow should this be manually tested?
See above
Any background context you want to provide?
Github issue: #752
What are the relevant tickets?
https://segment.atlassian.net/browse/LIBMOBILE-211
Screenshots or screencasts (if UI/UX change)
Questions: