0

A weird thing happening; I am trying to fetch all the records that do not contain '@' however, not all of the records are returned. so weird. This is my code:

static func loadRateToUserDefault() -> Void {

    var appSyncClient: AWSAppSyncClient?
    let appDelegate = UIApplication.shared.delegate as! AppDelegate
    appSyncClient = appDelegate.appSyncClient
    let selectQuery = ListTranscriberConfigsQuery()

    var filter = ModelTranscriberConfigFilterInput()
    var nameString = ModelStringInput()
    nameString.notContains = "@"
    filter.param = nameString
    selectQuery.filter = filter


    appSyncClient?.fetch(query: selectQuery, cachePolicy: .fetchIgnoringCacheData) {(result, error) in
        if error != nil {
            print(error?.localizedDescription ?? "")
            return
        }

        result?.data?.listTranscriberConfigs?.items!.forEach {
            print($0?.param)
            if ($0?.param)! == UserDefaultK.comprehendRate
            {
                UserDefaults.standard.set(Double(($0?.value)!) ?? 0.0,forKey: UserDefaultK.comprehendRate)
            }

            print(($0?.param)! + " " + ($0?.value)!)
        }
    }
}
  • How many items do you get with this call? The default limit is 100 if I remember correctly, so you need to set a filter with an appropriate number or make multiple calls. – DontEatMyCookies Mar 31 '21 at 08:53
  • with the filter above (not containing '@'), it should return around 50 records – Hamed Ansari Apr 04 '21 at 07:30

0 Answers0