Firebase Crash pod 在 iOS 时中断了设备旋转
Firebase Crash pod breaks device rotation on iOS
按照最佳实践指南配置 Firebase,并使用 "Firebase/Crash" pod,在使用 Swift 3 在 Xcode 8.1 中创建的干净 iOS 项目中中断设备旋转目标 iOS 10.1.
重现步骤
- 创建一个新的 iOS 项目(例如使用 iOS 模板 "Tabbed Application")。
- 将 "Firebase/Core" 和 "Firebase/Crash" pods 添加到您的 podfile,安装 pods,然后打开为您的项目新建的工作区文件。
- 将相应的
GoogleService-Info.plist
文件添加到您的项目中。
- 在您的应用委托中重写
init()
以配置 Firebase,如下所示。
- 观察您的应用程序目标的部署信息在 "Device Orientation" 下勾选了 "Portrait"、"Landscape Left" 和 "Landscape Right"。
- 运行模拟器中的app,左右旋转
配置 Firebase
Firebase 应在 AppDelegate.swift
中配置如下:
override init() {
super.init()
FIRApp.configure() // This line breaks rotation if "Firebase/Crash" is installed.
}
Firebase 对 iOS 的“best practices”指南指出,当 Firebase 未通过覆盖应用程序委托中的 init()
配置时,事情 "can go wrong"。言外之意是在application(_:didFinishLaunchingWithOptions:)
中配置Firebase是一个编程错误。但是,如果采用后一种方法,设备旋转将按预期运行。
还建议遵循 Firebase 的最佳实践指南。
问题
- 为什么以这种方式配置 Firebase 会破坏设备旋转?
- 如果我想同时使用 "Firebase/Crash" 和 "Firebase/Database" 并以最佳实践指南中描述的方式启用离线持久性,那么在不中断设备轮换的情况下配置 Firebase 的合适方法是什么?
看来at least one other user也遇到了同样的问题。
Firebase 支持人员建议为 iOS 配置 Firebase 的适当方法在 application:didFinishLaunchingWithOptions
中:"This is a correct approach and you should not encounter any problem."
current documentation 声明 Firebase "typically" 使用此方法配置。
他们还建议,将在内部讨论 iOS 的“best practices”指南,以确定它是否 "still relevant or needs to be updated"。
按照最佳实践指南配置 Firebase,并使用 "Firebase/Crash" pod,在使用 Swift 3 在 Xcode 8.1 中创建的干净 iOS 项目中中断设备旋转目标 iOS 10.1.
重现步骤
- 创建一个新的 iOS 项目(例如使用 iOS 模板 "Tabbed Application")。
- 将 "Firebase/Core" 和 "Firebase/Crash" pods 添加到您的 podfile,安装 pods,然后打开为您的项目新建的工作区文件。
- 将相应的
GoogleService-Info.plist
文件添加到您的项目中。 - 在您的应用委托中重写
init()
以配置 Firebase,如下所示。 - 观察您的应用程序目标的部署信息在 "Device Orientation" 下勾选了 "Portrait"、"Landscape Left" 和 "Landscape Right"。
- 运行模拟器中的app,左右旋转
配置 Firebase
Firebase 应在 AppDelegate.swift
中配置如下:
override init() {
super.init()
FIRApp.configure() // This line breaks rotation if "Firebase/Crash" is installed.
}
Firebase 对 iOS 的“best practices”指南指出,当 Firebase 未通过覆盖应用程序委托中的 init()
配置时,事情 "can go wrong"。言外之意是在application(_:didFinishLaunchingWithOptions:)
中配置Firebase是一个编程错误。但是,如果采用后一种方法,设备旋转将按预期运行。
问题
- 为什么以这种方式配置 Firebase 会破坏设备旋转?
- 如果我想同时使用 "Firebase/Crash" 和 "Firebase/Database" 并以最佳实践指南中描述的方式启用离线持久性,那么在不中断设备轮换的情况下配置 Firebase 的合适方法是什么?
看来at least one other user也遇到了同样的问题。
Firebase 支持人员建议为 iOS 配置 Firebase 的适当方法在 application:didFinishLaunchingWithOptions
中:"This is a correct approach and you should not encounter any problem."
current documentation 声明 Firebase "typically" 使用此方法配置。
他们还建议,将在内部讨论 iOS 的“best practices”指南,以确定它是否 "still relevant or needs to be updated"。