Flutterfire ios配置问题

Nan*_*ame 6 dart firebase flutter

由于某种原因,我无法使用 Flutterfire CLI 在 firebase 上配置 ios 应用程序。我以前这样做过,但这次我收到了这个错误

FirebaseCommandException: An error occured on the Firebase CLI when attempting to run a command.
COMMAND: firebase apps:create ios good_dreams (ios) --bundle-id=com.infatechnologies.good_dreams --json --project=good-dreams-app 
ERROR: Failed to create iOS app for project good-dreams-app. See firebase-debug.log for more info.
Run Code Online (Sandbox Code Playgroud)

我尝试检查 debug.log 文件以查看问题所在,并看到一个带有 401 错误代码的发布请求作为响应。

{
"error": {
"code": 401,
"message": "Request is missing required authentication credential. Expected OAuth 2 access token, login cookie or other valid authentication credential. See https://developers.google.com/identity/sign-in/web/devconsole-project.",
"status": "UNAUTHENTICATED",
"details": [
{
"@type": "type.googleapis.com/google.rpc.ErrorInfo",
"reason": "CREDENTIALS_MISSING",
"domain": "googleapis.com",
"metadata": {
"method": "google.firebase.service.v1beta1.IosAppService.ListIosApps",
"service": "firebase.googleapis.com"
}
}
]
}
}
Run Code Online (Sandbox Code Playgroud)

这些缺失的凭证是什么?我如何获得它们?这是整个 firebase-debug.log 文件:

[debug] [2022-02-15T15:41:11.658Z] ----------------------------------------------------------------------
[debug] [2022-02-15T15:41:11.660Z] Command:       /usr/local/bin/firebase /Users/user/.cache/firebase/tools/lib/node_modules/firebase-tools/lib/bin/firebase apps:create ios good_dreams (ios) --bundle-id=com.infatechnologies.good_dreams --json --project=good-dreams-app
[debug] [2022-02-15T15:41:11.660Z] CLI Version:   10.0.1
[debug] [2022-02-15T15:41:11.660Z] Platform:      darwin
[debug] [2022-02-15T15:41:11.660Z] Node Version:  v12.18.1
[debug] [2022-02-15T15:41:11.661Z] Time:          Tue Feb 15 2022 15:41:11 GMT+0000 (Greenwich Mean Time)
[debug] [2022-02-15T15:41:11.661Z] ----------------------------------------------------------------------
[debug] 
[debug] [2022-02-15T15:41:11.708Z] > command requires scopes: ["email","openid","https://www.googleapis.com/auth/cloudplatformprojects.readonly","https://www.googleapis.com/auth/firebase","https://www.googleapis.com/auth/cloud-platform"]
[debug] [2022-02-15T15:41:11.708Z] > authorizing via signed-in user (aduhenry9@gmail.com)
[info] Create your IOS app in project good-dreams-app:
[debug] [2022-02-15T15:41:11.712Z] >>> HTTP REQUEST POST https://firebase.googleapis.com/v1beta1/projects/good-dreams-app/iosApps  
 {"displayName":"good_dreams (ios)","bundleId":"com.infatechnologies.good_dreams"}
[debug] [2022-02-15T15:41:12.192Z] <<< HTTP RESPONSE 400 {"vary":"X-Origin, Referer, Origin,Accept-Encoding","content-type":"application/json; charset=UTF-8","date":"Tue, 15 Feb 2022 15:41:12 GMT","server":"ESF","cache-control":"private","x-xss-protection":"0","x-frame-options":"SAMEORIGIN","x-content-type-options":"nosniff","alt-svc":"h3=\":443\"; ma=2592000,h3-29=\":443\"; ma=2592000,h3-Q050=\":443\"; ma=2592000,h3-Q046=\":443\"; ma=2592000,h3-Q043=\":443\"; ma=2592000,quic=\":443\"; ma=2592000; v=\"46,43\"","accept-ranges":"none","transfer-encoding":"chunked"}
[debug] [2022-02-15T15:41:12.193Z] <<< HTTP RESPONSE BODY {"error":{"code":400,"message":"Request contains an invalid argument.","status":"INVALID_ARGUMENT"}}
[debug] [2022-02-15T15:41:12.194Z] HTTP Error: 400, Request contains an invalid argument.
[debug] [2022-02-15T15:41:12.689Z] FirebaseError: HTTP Error: 400, Request contains an invalid argument.
    at module.exports (/Users/user/.cache/firebase/tools/lib/node_modules/firebase-tools/lib/responseToError.js:38:12)
    at Request._callback (/Users/user/.cache/firebase/tools/lib/node_modules/firebase-tools/lib/api.js:41:35)
    at Request.self.callback (/Users/user/.cache/firebase/tools/lib/node_modules/request/request.js:185:22)
    at Request.emit (events.js:315:20)
    at Request.EventEmitter.emit (domain.js:482:12)
    at Request.<anonymous> (/Users/user/.cache/firebase/tools/lib/node_modules/request/request.js:1154:10)
    at Request.emit (events.js:315:20)
    at Request.EventEmitter.emit (domain.js:482:12)
    at IncomingMessage.<anonymous> (/Users/user/.cache/firebase/tools/lib/node_modules/request/request.js:1076:12)
    at Object.onceWrapper (events.js:421:28)
    at IncomingMessage.emit (events.js:327:22)
    at IncomingMessage.EventEmitter.emit (domain.js:482:12)
    at endReadableNT (_stream_readable.js:1221:12)
    at processTicksAndRejections (internal/process/task_queues.js:84:21)
[error] 
[error] Error: Failed to create iOS app for project good-dreams-app. See firebase-debug.log for more info.
Run Code Online (Sandbox Code Playgroud)

小智 7

配置 iOS:

flutterfire configure -i com.ios.bubdle
Run Code Online (Sandbox Code Playgroud)

所以添加 -i 然后是你的 (ios) 包 ID

来自CLI 命令


her*_*des 6

啊哈!我已经找到答案了。因此,出于某种原因,苹果不允许在bundleId名称中使用下划线(“_”),将您的bundleId更改为不使用下划线,您就可以开始了。

让我知道这是否有帮助。


Nan*_*ame 2

我认为捆绑包ID(ios)和包名称(android)应该相同,但它们不应该相同。组织可能是相同的,但最后出现的不应该相同。这就是问题所在,尽管我能找到的任何指南/教程中都没有说明这一点,甚至在错误消息中也没有说明