'EXC_BAD_ACCESS code=2 on including Firebase/Auth in Podfile

I am getting EXC_BAD_ACCESS after including 'Firebase/Auth' in Podfile. This happens without adding any line of firebase code. I am using swift3 on xcode 8 and the resultant pods are -

Installing Firebase (3.8.0)
Installing FirebaseAnalytics (3.5.1)
Installing FirebaseAuth (3.0.6)
Installing FirebaseCore (3.4.4)
Installing FirebaseInstanceID (1.0.8)
Using GTMOAuth2 (1.1.4)
Using GTMSessionFetcher (1.1.7)
Using GoogleAppUtilities (1.1.2)
Installing GoogleInterchangeUtilities (1.2.2)
Using GoogleSignIn (4.0.1)
Using GoogleSymbolUtilities (1.1.2)
Installing GoogleToolboxForMac 2.1.0 (was 2.1.0)
Using Localize-Swift (1.6)
Using ProtocolBuffers-Swift (3.0.6)
Using QorumLogs (0.9)

The error comes in Thread 1 in [UIViewController(FIRAScreenClassName) fira_viewDidAppear:]:

This happens only if the pod target is itself a framework which is embedded in an app eventually.

I do have Google analytics as well. Is it because ARC is not enabled? How do I do that on xcode-8? Any other options to try?



Solution 1:[1]

I made a silly mistake. Never turned on Google under Authentication -> Sign in methods on Firebase

Solution 2:[2]

I am suspecting that the Podfile is not correct. I got into similar problem by adding Firebase dependency into a framework and I ran into the problem like this

objc[12345]: Class FIRAAppEnvironmentUtil is implemented in both /Users/...Build/Products/Debug-iphonesimulator/SomeFramework.framework/SomeFramework (0x105ef7fc8) and /Users/.../CurrentProject.app/CurrentProject (0x105945108). One of the two will be used. Which one is undefined.

As mentioned in this post, you might have duplicate dependencies in different targets which could lead to weird bug like this. Adding Firebase pod into the main target and removing the Firebase pod from the framework fixed the problem for me.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Kavin Varnan
Solution 2 Glorfindel