本文介绍了在没有 Xcode 的情况下在 Flutter 中将 GoogleService-Info.plist 保存在哪里?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的应用已在 Google Play & 中提交、审核并在线iTunes,但最近我为通知功能添加了 firebase_messaging 插件.

I have my app already submited, reviewed and online in Google Play & iTunes, but recently I added the firebase_messaging plugin for notification feature.

在加入 Firebase Cloud Messaging 时,Google 强迫我下载两个文件:

While joining the Firebase Cloud Messaging, Google forced me to download two files:

  • google-services.json - 保存在我的flutter App的文件夹中:MyAppandroidapp
  • GoogleService-Info.plist - 我不知道在哪里保存它,但尝试了 MyAppiosRunnerMyAppiosRunner.xcodeworkspace 没有成功
  • google-services.json - Saved in the folder of my flutter App: MyAppandroidapp
  • GoogleService-Info.plist - I don't know where to save it, but tried on MyAppiosRunner and MyAppiosRunner.xcodeworkspace without success

所有教程都指向使用 Xcode 正确设置文件 GoogleService-Info.plist,但我没有 Mac,我一直在成功使用 windows 应用程序 AppUploader 提交我的 iOS 应用程序.

And all the tutorials point to the use of Xcode to set the file GoogleService-Info.plist properly, but I do not own a Mac and I've been using with success the windows application AppUploader to submit my iOS apps.

有什么方法可以不使用 Xcode 并能够将 GoogleService-Info.plist 附加到我的项目中?

Is there any way to not use the Xcode and be able to attach the GoogleService-Info.plist to my project?

推荐答案

如果你想避免使用 Xcode,你必须手动编辑这个文件:/ios/Runner.xcodeproj/project.pbxproj

If you want to avoid using Xcode, you have to manually edit this file :/ios/Runner.xcodeproj/project.pbxproj

您需要参考 GoogleService-Info.plist 才能将其包含在构建过​​程中.

You will need to reference GoogleService-Info.plist in order to make it included during the build process.

以下是您需要添加一行的 4 个不同部分(请参阅 GoogleService-Info.plist 的示例行):

Here are the 4 differents sections where you need to add a line (see example line for GoogleService-Info.plist):

/* Begin PBXBuildFile section */
        1498D2341E8E89220040F4C2 /* GeneratedPluginRegistrant.m in Sources */ = {isa = PBXBuildFile; fileRef = 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */; };
        3B3967161E833CAA004F5970 /* AppFrameworkInfo.plist in Resources */ = {isa = PBXBuildFile; fileRef = 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */; };
        3B80C3941E831B6300D905FE /* App.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 3B80C3931E831B6300D905FE /* App.framework */; };
        3B80C3951E831B6300D905FE /* App.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 3B80C3931E831B6300D905FE /* App.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
        74858FAF1ED2DC5600515810 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 74858FAE1ED2DC5600515810 /* AppDelegate.swift */; };
        9705A1C61CF904A100538489 /* Flutter.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 9740EEBA1CF902C7004384FC /* Flutter.framework */; };
        9705A1C71CF904A300538489 /* Flutter.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 9740EEBA1CF902C7004384FC /* Flutter.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
        97C146FC1CF9000F007C117D /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FA1CF9000F007C117D /* Main.storyboard */; };
        DE4C455E21DE1E4300EA0709 /* GoogleService-Info.plist in Resources */ = {isa = PBXBuildFile; fileRef = DE4C455D21DE1E4300EA0709 /* GoogleService-Info.plist */; };
        97C146FE1CF9000F007C117D /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FD1CF9000F007C117D /* Assets.xcassets */; };
        97C147011CF9000F007C117D /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */; };
/* End PBXBuildFile section */

这里:

/* Begin PBXFileReference section */
        1498D2321E8E86230040F4C2 /* GeneratedPluginRegistrant.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = GeneratedPluginRegistrant.h; sourceTree = "<group>"; };
        1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GeneratedPluginRegistrant.m; sourceTree = "<group>"; };
        3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = AppFrameworkInfo.plist; path = Flutter/AppFrameworkInfo.plist; sourceTree = "<group>"; };
        3B80C3931E831B6300D905FE /* App.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = App.framework; path = Flutter/App.framework; sourceTree = "<group>"; };
        74858FAD1ED2DC5600515810 /* Runner-Bridging-Header.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "Runner-Bridging-Header.h"; sourceTree = "<group>"; };
        74858FAE1ED2DC5600515810 /* AppDelegate.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = "<group>"; };
        7AFA3C8E1D35360C0083082E /* Release.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; name = Release.xcconfig; path = Flutter/Release.xcconfig; sourceTree = "<group>"; };
        9740EEB21CF90195004384FC /* Debug.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = Debug.xcconfig; path = Flutter/Debug.xcconfig; sourceTree = "<group>"; };
        9740EEB31CF90195004384FC /* Generated.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = Generated.xcconfig; path = Flutter/Generated.xcconfig; sourceTree = "<group>"; };
        9740EEBA1CF902C7004384FC /* Flutter.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Flutter.framework; path = Flutter/Flutter.framework; sourceTree = "<group>"; };
        97C146EE1CF9000F007C117D /* Runner.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Runner.app; sourceTree = BUILT_PRODUCTS_DIR; };
        97C146FB1CF9000F007C117D /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = "<group>"; };
        97C146FD1CF9000F007C117D /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = "<group>"; };
        97C147001CF9000F007C117D /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = "<group>"; };
        97C147021CF9000F007C117D /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
        DE4C455D21DE1E4300EA0709 /* GoogleService-Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = "GoogleService-Info.plist"; sourceTree = "<group>"; };

/* End PBXFileReference section */

这里:

97C146F01CF9000F007C117D /* Runner */ = {
    isa = PBXGroup;
    children = (
        97C146FA1CF9000F007C117D /* Main.storyboard */,
        97C146FD1CF9000F007C117D /* Assets.xcassets */,
        97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */,
        97C147021CF9000F007C117D /* Info.plist */,
        DE4C455D21DE1E4300EA0709 /* GoogleService-Info.plist */,
        97C146F11CF9000F007C117D /* Supporting Files */,
        1498D2321E8E86230040F4C2 /* GeneratedPluginRegistrant.h */,
        1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */,
        74858FAE1ED2DC5600515810 /* AppDelegate.swift */,
        74858FAD1ED2DC5600515810 /* Runner-Bridging-Header.h */,
    );
    path = Runner;
    sourceTree = "<group>";
};

这里:

/* Begin PBXResourcesBuildPhase section */
        97C146EC1CF9000F007C117D /* Resources */ = {
            isa = PBXResourcesBuildPhase;
            buildActionMask = 2147483647;
            files = (
                97C147011CF9000F007C117D /* LaunchScreen.storyboard in Resources */,
                3B3967161E833CAA004F5970 /* AppFrameworkInfo.plist in Resources */,
                97C146FE1CF9000F007C117D /* Assets.xcassets in Resources */,
                97C146FC1CF9000F007C117D /* Main.storyboard in Resources */,
                DE4C455E21DE1E4300EA0709 /* GoogleService-Info.plist in Resources */,
            );
            runOnlyForDeploymentPostprocessing = 0;
        };
/* End PBXResourcesBuildPhase section */

使用 codemagic 测试成功,此修改使提供的 GoogleService-Info.plist 包含在 App IPA 中

Tested successfully with codemagic, this modification made the provided GoogleService-Info.plist included in the App IPA

这篇关于在没有 Xcode 的情况下在 Flutter 中将 GoogleService-Info.plist 保存在哪里?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-24 15:32