Skip to content
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

Adds subspec workaround. #23

Merged
merged 2 commits into from
Apr 2, 2018
Merged

Adds subspec workaround. #23

merged 2 commits into from
Apr 2, 2018

Conversation

ladanazita
Copy link
Contributor

This workaround to Cocoapods Static Library/Framework.

The limitation occurs when an application is built in Swift, you are including use_frameworks! in your podfile, and are using a transitive dependency that is provided as a static library or framework.

The current workaround (as outlined in this subspec) is to copy the integration code manually into your project, then depend on Firebase directly. Instead of importing the integration from our library you would import the integration from your local copy. This eliminates the transitive dependency from the App -> Segment-Firebase -> Firebase to App -> Firebase.

Tested with the following configurations

Without use_frameworks!

  • Use default subspec

With use_frameworks!

  • Use only Segment-Firebase/StaticLibWorkaround

CC @TeresaNesteby

@ladanazita ladanazita requested a review from tonyxiao April 2, 2018 20:32
@ladanazita
Copy link
Contributor Author

ladanazita commented Apr 2, 2018

Tested end to end here:
https://github.com/segmentio/analytics-test-apps/tree/firebase_staticLib

Steps to implement this solution:

Podfile

target 'AnalyticsIOSTestApp' do
  pod 'Analytics'
  pod 'Firebase'
  pod 'Segment-Firebase/StaticLibWorkaround'
end

Run pod install

In your app, you will see that Pods > Segment-Firebase is empty.

screenshot 2018-04-02 14 26 58

Right click and Show in Finder
screenshot 2018-04-02 14 27 05

You will see the Classes > SEGFirebaseIntegration files.
Drag and drop them into the top level of your iOS App
Make sure Create groups is selected

screenshot 2018-04-02 14 27 32

Then update your bridging header:

#import "SEGFirebaseIntegrationFactory.h"

And follow the normal steps to import the integration into your AppDelegate.swift:

#import "SEGFirebaseIntegrationFactory.h"
config.use(SEGFirebaseIntegrationFactory.instance())

@ladanazita ladanazita requested a review from f2prateek April 2, 2018 20:50
@f2prateek
Copy link
Contributor

If the customer has to copy the files for this integration into their project, what purpose does pod 'Segment-Firebase/StaticLibWorkaround', :path => '../' serve?

I think they could just copy those files and do pod 'Firebase' and it would still work without pod 'Segment-Firebase/StaticLibWorkaround', :path => '../'?

@ladanazita
Copy link
Contributor Author

@f2prateek It's just convenient and still allows them to "pull in" the files from a Cocoapods pod install vs navigating to the Github repo

@f2prateek
Copy link
Contributor

Gotcha.

@ladanazita ladanazita merged commit 14eb8ac into master Apr 2, 2018
@ladanazita ladanazita deleted the static-lib-workaround branch April 2, 2018 22:01
@ladanazita
Copy link
Contributor Author


🎉 Congrats

🚀 Segment-Firebase (2.2.0) successfully published
📅 April 2nd, 15:44
🌎 https://cocoapods.org/pods/Segment-Firebase
👍 Tell your friends!

This was referenced Apr 3, 2018
tonyxiao added a commit to segmentio/analytics-test-apps that referenced this pull request Apr 4, 2018
@Fawxy
Copy link

Fawxy commented Apr 11, 2018

Do we need the full pod 'Firebase' or is pod 'Firebase/Core' enough?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants