segment-integrations / analytics-ios-integration-firebase

Segment's bundled integration for Firebase on iOS
MIT License
13 stars 92 forks source link

Random crash while using Segmennt-Firebase #26

Closed vaibhav-nickelfox closed 3 years ago

vaibhav-nickelfox commented 6 years ago

After successfully adding 'Segment-Firebase/StaticLibWorkaround' via pods, when running app, getting a crash.

screen shot 2018-05-11 at 6 38 31 pm
radiofreejohn commented 6 years ago

@vaibhav-nickelfox I’ve seen a similar crash with firebase and a different library that also swizzles viewDidAppear (Heap - where I work), are you also using Firebase/Performance?

If so does the crash happen when you uninstall that pod?

Are you initializing Segment before or after Firebase?

vaibhav-nickelfox commented 6 years ago

@radiofreejohn I was using 'Firebase/Core' and yes there was no crash when I uninstalled the pod. Firebase was getting initialised after segment.

radiofreejohn commented 6 years ago

@vaibhav-nickelfox interesting – I only saw this with the Performance pod – are you on the latest version of cocoapods and using the latest pods?

For what it's worth, on the performance pod, using the previous major version fixed the crash. I reached out to Firebase and they were not helpful – my best guess is that they are doing some aggressive method swizzling and in some situations, the swizzled methods don't play well with other libraries that also swizzle.

The only workaround I could come up with was to actually build our library to attempt to detect Firebase's swizzling and use a saved function pointer for the network connection. Since yours isn't related to Performance there's probably something else going on. The only thing I can think of that might give you more information is if you got a full backtrace from this crash to get a better idea of which part of Firebase is misbehaving.

Anyhow, sorry about this – I think as far as Firebase goes, it's a black hole, and the workaround I have is really brittle and I wouldn't recommend it :(

vaibhav-nickelfox commented 6 years ago

@radiofreejohn In my project, there were two targets one for Model and the other one for the project. Segment and Firebase were in Model. The workaround I tried was to remove Model and put Segment, Firebase and other pods in single target. So far I've not faced any related crash.

alanjcharles commented 3 years ago

Closing as there hasn't been any activity in a few years. Please reopen if still relevant