Comments (5)
I see this problem also, when integrating Firebase DynamicLinks, as of version 2.4. As far as I can tell, it renders the integration unusable in any app that wants to use DynamicLinks. The fix above does appear to work, although I haven't verified whether there are other side effects.
from analytics-ios-integration-firebase.
@gpitfield I have discovered some side effects of my fix, so for you and others who want to use it, please note that the dynamic links will not work if starting the app from the cold state. This is because the fix delays the Firebase setup (namely the moment when [FIRApp configure]
is called). So when starting from cold, returning true
from ...didFinishLaunchingWithOptions
the ...application: UIApplication, continue userActivity: NSUserActivity, restorationHandler...
will be called, but at this time the Firebase SDK is not configured properly, so DynamicLinks.dynamicLinks().handleUniversalLink(url)
will return false and your callback will never be called.
I have patched this for myself by posting a notification from line 22 of SEGFirebaseIntegration
but this is more a hack than anything else. The proper fix should be to actually run the integration setup code on the main queue for the integrations that need this.
from analytics-ios-integration-firebase.
I also use the swizzling for fixing this issue:
Call FirebaseApp.exchange()
before the SegmentAnalytics(apiKey: apiKey, factories: factories)
then the FirebaseApp.configure()
will be called in the main thread.
extension FirebaseApp {
class func exchange() {
let origin = #selector(configure as () -> Void)
let with = #selector(myConfigure)
exchangeMethod(origin, with: with)
}
@objc
class func myConfigure() {
DispatchQueue.main.async {
myConfigure()
}
}
class func exchangeMethod(_ originalSelector: Selector, with overriddenSelector: Selector) {
guard
let originalMethod = class_getClassMethod(self, originalSelector),
let overriddenMethod = class_getClassMethod(self, overriddenSelector) else {
return
}
method_exchangeImplementations(originalMethod, overriddenMethod)
}
}
from analytics-ios-integration-firebase.
Another thing to be considered: Because the Segment will have a remote call to fetch the configuration setting options before the FirebaseApp.configure()
got called. Before that, the FirebaseApp.app() is always nil, if you want to use any feature of it, you need to wait for the remote call return and configure
being called. There is a notification we can use to detect this: FIRAppReadyToConfigureSDKNotification.
from analytics-ios-integration-firebase.
@briemcnally, maybe you could add some input on this issue?
from analytics-ios-integration-firebase.
Related Issues (20)
- Increase version firebase core to 10.12.0 or higher HOT 6
- Swift Package Manager (SPM) Support HOT 5
- Is it possible to read a different GoogleService-Info.plist file HOT 2
- Use of undeclared identifier 'config' HOT 2
- Version 2.7.3 uses an invalid import from FirebaseCore HOT 2
- Don't call [FIRApp configure] on behalf of user's application HOT 2
- Upgrade Firebase SDK version to 8 HOT 9
- Header imports in 2.7.7 not compiling HOT 2
- Suport for Firebase 7.11 HOT 1
- Support for Firebase 7.7.0 HOT 1
- Need support for Firebase 8 HOT 7
- Support for Firebase 8.8.0 HOT 1
- Cannot build the project when adding SegmentFirebase with Swift Package Manager, 'Segment/Segment.h' file not found HOT 3
- -[FBLPromise HTTPBody]: unrecognized selector sent to instance HOT 2
- Update Firebase support to 9.1.0 HOT 1
- SEGFirebaseIntegration does not set Crashlytics UserId HOT 1
- Increase version firebase core to 10.0.0 or higher HOT 5
- Proposal to reduce download size. HOT 2
- Debugin integratiuon HOT 1
- can download hd
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from analytics-ios-integration-firebase.