ios 在您的项目中找不到有效的 GoogleService-Info.plist
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/45317777/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Could not find a valid GoogleService-Info.plist in your project
提问by adam eliezerov
When I run my swift 3.2 code with Xcode 9 beta 4 this is the error I get:
当我使用 Xcode 9 beta 4 运行我的 swift 3.2 代码时,这是我得到的错误:
*** Terminating app due to uncaught exception 'com.firebase.core', reason: '[FIRApp configure]; (FirebaseApp.configure() in Swift) could not find a valid GoogleService-Info.plist in your project. Please download one from https://console.firebase.google.com/.'
*** Terminating app due to uncaught exception 'com.firebase.core', reason: '[FIRApp configure]; (FirebaseApp.configure() in Swift) could not find a valid GoogleService-Info.plist in your project. Please download one from https://console.firebase.google.com/.'
I already have a GoogleService-Info.plist file that is named exactly like it should and it is valid.
我已经有一个 GoogleService-Info.plist 文件,它的名称与它应该完全一样,并且是有效的。
Is there any trial to firebase or something like that?
有没有对火力基地或类似的东西的试验?
回答by harshal jadhav
Remove the Google-Info.plist
file from your project and try to add it from your project folder's option menu.
Google-Info.plist
从项目中删除该文件并尝试从项目文件夹的选项菜单中添加它。
回答by Arjun Kalidas
I had the same issue.
我遇到过同样的问题。
Click on the Googleservice-info.plist in your project and check Target Membership for app in the inspector. That fixed it for me.
单击项目中的 Googleservice-info.plist 并在检查器中检查应用程序的目标成员资格。那为我修好了。
That is the reason for this crash and removing the file and adding again is another way of doing as suggested by answers above. But the actual cause is this and this is the right way to solve it.
这就是崩溃的原因,删除文件并再次添加是上述答案所建议的另一种方法。但真正的原因是这个,这是解决它的正确方法。
Please refer to the image below for further clarification:
请参阅下图以进一步说明:
回答by Andrew Ko
Once you add the file to the project, you may also need to add it to Build Phasesin the Compile Sourcessection.
一旦将文件添加到项目中,您可能还需要将它添加到构建阶段的编译源代码部分。
回答by kakubei
If you have multiple environments (Production, Develop, Staging), you will need a different Google.plist for each.
如果您有多个环境(生产、开发、暂存),则每个环境都需要不同的 Google.plist。
They all have to have the same name.
它们都必须具有相同的名称。
To get around this, create folders for each of these files (one for each environment) and place them inside their corresponding folders.
要解决此问题,请为这些文件中的每一个创建文件夹(每个环境一个)并将它们放在相应的文件夹中。
When you drag the files from the Finder to Xcode, make sure to select the proper environment for each under Target Membership
当您将文件从 Finder 拖到 Xcode 时,请确保为Target Membership下的每个文件选择合适的环境
That will do the trick and allow you to build environments separately. Especially if each environment has a different Bundle ID.
这将解决问题并允许您单独构建环境。特别是如果每个环境都有不同的 Bundle ID。
回答by Bennybear
For those of you working with Ionic, make sure to open your .xcworkspace file in Xcode first, then drag the GoogleService-info.plist file into the Resources folder.
对于那些使用 Ionic 的人,请确保首先在 Xcode 中打开 .xcworkspace 文件,然后将 GoogleService-info.plist 文件拖到 Resources 文件夹中。
Most tutorials online don't do a good job of explaining that portion for some reason.
由于某种原因,大多数在线教程都没有很好地解释该部分。
Shout out to Shahzaib Maqbool because his comment helped me get this for my project.
向 Shahzaib Maqbool 大喊大叫,因为他的评论帮助我为我的项目获得了这个。
回答by Sivajee Battina
Unfortunately or fortunately, the error specified is very accurate. There is only one option available right now. i.,e placing Google-Info.plist
file in your project properly. Try to remove and add that again. Also, check if a target is selected or not.
不幸或幸运的是,指定的错误非常准确。目前只有一种选择。i.,e 将Google-Info.plist
文件正确放置在您的项目中。尝试删除并再次添加。另外,检查是否选择了目标。
回答by Steve
- Make sure the name of the file is correct, i.e: "
GoogleService-info.plist
" - Add it to the project in mac
finder
under the project name and then drag it into the project to reference it. - Finally, as Silvajee mentioned, go to the
file inspector
for the plist file and tick the box undertarget membership
to include it as part of theproject
.
- 确保文件名正确,即:“
GoogleService-info.plist
” - 将其添加到mac
finder
中项目名称下的项目中,然后将其拖入项目以引用它。 - 最后,正如 Silvajee 提到的,转到
file inspector
plist 文件的 并勾选下面的框target membership
以将其作为project
.
回答by Shahzaib Maqbool
These steps solved my problem. FOllow these. 1.You must drag and drop the GoogleService-Info.plist file into your project in a location such as Shared Resources. When you have successfully added the file, you should also make sure to include it in the project build:
这些步骤解决了我的问题。按照这些。1.您必须将 GoogleService-Info.plist 文件拖放到您的项目中的共享资源等位置。成功添加文件后,还应确保将其包含在项目构建中:
2.Double-check that in the "Build Phases" section of your project that your project is including GoogleService-Info.plist.
2.在项目的“构建阶段”部分仔细检查您的项目是否包含 GoogleService-Info.plist。
3.Double check the file name. The file name must be exactly GoogleService-Info.plist common misspellings include GoogleServices-Info.plist and GoogleService-info.plist - case sensitive and exactly named only will work.
3.仔细检查文件名。文件名必须完全是 GoogleService-Info.plist 常见的拼写错误包括 GoogleServices-Info.plist 和 GoogleService-info.plist - 区分大小写和准确命名才有效。
回答by Nasir Khan
Restarting Xcode worked for me, none of the above option worked.
重新启动 Xcode 对我有用,上述选项均无效。
回答by Ashvini
Actually this error is occur when GoogleService-Info.plist file is not actually located in our project folder but it just have a reference to that file where it is downloaded. So solution is that remove reference to this file and again add it to your project folder by drag and drop or by using "Add Files ..." option by right click to your project folder. Also recheck whether file is locating your project folder destination otherwise error will be occur again.
Don't forget to check your "GoogleService-Info.plist" file have same name as shown in error otherwise rename it.
实际上,当 GoogleService-Info.plist 文件实际上不在我们的项目文件夹中时会发生此错误,但它只是引用了下载该文件的文件。因此,解决方案是删除对此文件的引用,然后通过拖放或右键单击项目文件夹使用“添加文件...”选项将其再次添加到项目文件夹中。还要重新检查文件是否正在定位您的项目文件夹目标,否则将再次发生错误。
不要忘记检查您的“GoogleService-Info.plist”文件是否与错误中显示的名称相同,否则重命名它。