Aws-sdk-ios: Generic parameter Query could not be inferred with AppSync fetch

Created on 1 Aug 2019  路  2Comments  路  Source: aws-amplify/aws-sdk-ios

State your question
How to solve error Generic parameter 'Query' could not be inferred when attempting an AppSync fetch?
Which AWS Services are you utilizing?
AWS AppSync, Amplify
Provide code snippets (if applicable)

let allPOQuery = AllProcessOrdersQuery(limit: 20, nextToken: nextToken)
        // run query
        client?.fetch(query: allPOQuery) { result in
            switch result {
            case .success(let queryResult):
                print("Got query")

            case .failure(let error):
                print("Error: \(error)")
            }

Results in error Generic parameter 'Query' could not be inferred

Environment(please complete the following information):

  • SDK Version: [e.g. 2.6.29]
    2.14.0
  • Dependency Manager: [e.g. Cocoapods, Carthage]
    Cocoapods
  • Swift Version : [e.g. 4.0]
    5.0

Device Information (please complete the following information):

  • Device: [e.g. iPhone6, Simulator]
    iPad Air 2
  • iOS Version: [e.g. iOS 11.4]
    iOS 9.3

Error has been documented on Apollo SDK but using single parameter completion handler does not fix the issue 668

appsync question requesting info

Most helpful comment

@osandvold302 The version of the Apollo client we forked is well before the 0.13.0 version on which that issue is filed, but the root cause is similar: the fetch completion handler returns a (result, error) tuple, and you are operating on only one parameter, result. See examples in our docs for more detail.

Hope this helps.

All 2 comments

@osandvold302 The version of the Apollo client we forked is well before the 0.13.0 version on which that issue is filed, but the root cause is similar: the fetch completion handler returns a (result, error) tuple, and you are operating on only one parameter, result. See examples in our docs for more detail.

Hope this helps.

That works, not sure why I didn't catch it before :(

Thanks!

Was this page helpful?
0 / 5 - 0 ratings