skip to Main Content

Getting this error when i updated my project swift version 4 to 5.Check many post related to this error but not able fix that.

 "message": "Requests from this iOS client application u003cemptyu003e are blocked.",
"errors": [
  {
    "message": "Requests from this iOS client application u003cemptyu003e are blocked.",
    "domain": "global",
    "reason": "forbidden"
  }
],

2

Answers


  1. Chosen as BEST ANSWER

    The issue was the firebase updated version/SDK. It doesn’t cast [String: Any] to HTTPHeaders and always fails.

    let requestURL = URL(string: urlString)!
            let encoding: ParameterEncoding = (method == .get ? URLEncoding.default : JSONEncoding.default)
            var _headers: HTTPHeaders = HTTPHeaders()
            //  Convert header dictionary to HTTPHeaders
            if let headers = headers { for key in headers.keys { if let value = headers[key] as? String { _headers.add(name: key, value: value) }}}
            let request = alamofireManager.request(requestURL,
                                                   method: method,
                                                   parameters: parameters,
                                                   encoding: encoding,
                                                   headers: headers as? HTTPHeaders)
                                                   headers: _headers)
            request
                .validate(statusCode: 200..<500) //range of acceptable status code for the response success
                .responseData(completionHandler: { response in
    

  2. Same issue.

    " UserInfo={NSLocalizedFailureReason=The server responded with an error: 
     - URL: https://firebaseinstallations.googleapis.com/v1/projects/<app-name>/installations/ 
     - HTTP status code: 403 
     - Response body: {
      "error": {
        "code": 403,
        "message": "Requests from this iOS client application <bundle-id> are blocked.",
        "status": "PERMISSION_DENIED",
        "details": [
          {
            "@type": "type.googleapis.com/google.rpc.ErrorInfo",
            "reason": "API_KEY_IOS_APP_BLOCKED",
            "domain": "googleapis.com",
            "metadata": {
              "consumer": "projects/",
              "service": "firebaseinstallations.googleapis.com"
            }
          }
        ]
      }
    }
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search