Skip to content

iOS Could not locate configuration file: 'GoogleService-Info.plist' when the plist didn't locate at default path  #7510

@pShota

Description

@pShota

[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?

  1. 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

  2. Initialize Firebase with [FIRApp configureWithOptions:options] and use a custom path

  3. do not need to trigger any Analytics method, just make sure the FIRAnalytics class used in project and did not stripe out by compiler

  4. build and run on a device

  5. 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:185ede944b751de3

    but Analytics will start anyway:
    [Firebase/Analytics][I-ACS023007] Analytics v.7.5.0 started

    even 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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions