Configuring Firebase following their best practices guidance, and using the "Firebase/Crash" pod, breaks device rotation in a clean iOS project created in Xcode 8.1 using Swift 3 targeting iOS 10.1.
Steps to reproduce
GoogleService-Info.plist
file to your project.init()
in your app delegate to configure Firebase as shown below.Configuring Firebase
Firebase should be configured in AppDelegate.swift
as follows:
override init() {
super.init()
FIRApp.configure() // This line breaks rotation if "Firebase/Crash" is installed.
}
Firebase's "best practices" guidance for iOS states that things "can go wrong" when Firebase is not configured by overriding init()
in the app delegate. The implication is that it is a programming error to configure Firebase in application(_:didFinishLaunchingWithOptions:)
. If the latter approach is taken, however, device rotation functions as expected.
Other SO answers also recommend following Firebase's best practices guidance.
Questions
It appears that at least one other user has encountered the same problem.
Firebase Support has advised that the appropriate way to configure Firebase for iOS is in application:didFinishLaunchingWithOptions
: "This is a correct approach and you should not encounter any problem."
The current documentation states that Firebase is "typically" configured using this approach.
They also advised that the "best practices" guidance for iOS will be discussed internally to determine whether it is "still relevant or needs to be updated".