-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Description
[REQUIRED] Step 1: Describe your environment
- Xcode version: 12.4
- Firebase SDK version: 7.5.0
- Installation method:
CocoaPods - Firebase Component: Core, Analytics
[REQUIRED] Step 2: Describe the problem
Steps to reproduce:
What happened? How can we make the problem occur?
-
Create a new project,
place GoogleService-Info.plist under a folder, when import, click "create folder reference" in Xcode,
as a result GoogleService-Info.plist will locate at Appname.app/foldername/GoogleService-Info.plist -
Initialize Firebase with [FIRApp configureWithOptions:options] and use a custom path
-
do not need to trigger any Analytics method, just make sure the FIRAnalytics class used in project and did not stripe out by compiler
-
build and run on a device
-
NSLog "Invalid Firebase configuration file." did not trigger(code below), instead, Core will complain:
[Firebase/Core][I-COR000012] Could not locate configuration file: 'GoogleService-Info.plist'.
Also, Analytics will complain:
[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 https://goo.gl/txkZbE[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), 1:678167820568:ios:185ede944b751de3but Analytics will start anyway:
[Firebase/Analytics][I-ACS023007] Analytics v.7.5.0 startedeven logevent successfully apparently
[Firebase/Analytics][I-ACS023044] Successful upload. Got network response. Code, size: 204, -1
Relevant Code:
NSString* path = [[NSBundle mainBundle] pathForResource:@"foldername/GoogleService-Info" ofType:@"plist"];
FIROptions *options = [[FIROptions alloc] initWithContentsOfFile:path];
if (options == nil) {
NSLog(@"Invalid Firebase configuration file.");
}
[FIRApp configureWithOptions:options];
Remarks: the reason I need to load GoogleService-Info.plist in a custom path is because in Unreal Engine I have to load raw files under a folder
After some digging, my current "fix" for the problem is using iOS method swizzling on
[FIROptions plistFilePathWithName:]
[APMInfoPlistFileUtil googleServiceInfoPlistPath]
both methods to return the actual path of my GoogleService-Info.plist instead of default location
Thank you.