plist
文件,并通过传递正确的配置文件来初始化FirebaseApp,如下所示:let configPath = Bundle.main.path(forResource: NAME_OF_PLIST_FOR_CURRENT_TARGET ofType: ".plist")!
let options = FirebaseOptions(contentsOfFile: configPath)!
FirebaseApp.configure(options: options)
我还从我的项目中移除了
GoogleService-Info.plist
文件,如此处文档中建议的那样,以确保可靠的分析报告。当我在控制台中运行应用程序时,我看到以下消息。
[Firebase/Core][I-COR000012] Could not locate configuration file: 'GoogleService-Info.plist'.
[Firebase/Analytics][I-ACS020006] Google App ID from GoogleService-Info.plist is empty. Please, define GOOGLE_APP_ID in GoogleService-Info.plist for Analytics to work reliably. See
[Firebase/Analytics][I-ACS025020] Analytics requires Google App ID from GoogleService-Info.plist. Your data may be lost. Google App ID has been changed. Original, new ID: (nil), MYAPPID
我是否做错了什么?这个配置会导致分析数据丢失吗?(如控制台消息所示)
'Firebase/Core'
添加到项目中了。此外,当使用单个GoogleService-Info.plist
时,一切都正常(我的应用程序已经在生产中,并且分析正在工作)。 - francybiga