Reputation: 1636
I just migrated Xcode to 15 this made other pod file to get updated, after updating app sync 3+ I'm getting a nil
response
func configureAppSync() {
//AWS AppSync Initialization do {
let appsyncConfig = try AWSAppSyncClientConfiguration(appSyncServiceConfig: AWSAppSyncServiceConfig(), cacheConfiguration: AWSAppSyncCacheConfiguration())
appSyncClient = try AWSAppSyncClient(appSyncConfig: appsyncConfig) {
print("configureAppSync success", appSyncClient)
} catch {
print("configureAppSync error", error
}
}
func testAppsyncQuery(){
let dateFormatter = DateFormatter()
dateFormatter.dateFormat = "yyyy-MM-dd"
dateFormatter.locale = Locale(identifier: self.sendLanguageCode())
let getMonthSalesDetailsQuery = GetMonthSalesDetailsQuery(sapCode: UserDefaults.standard.string(forKey: "sapCode")!, dateValue: dateFormatter.string(from: self.date))
// Print the GraphQL query payload
let queryPayload = getMonthSalesDetailsQuery.variables
print("GraphQL Query Payload: \(queryPayload)")
appSyncClient?.fetch(query: getMonthSalesDetailsQuery, cachePolicy: .fetchIgnoringCacheData, queue: DispatchQueue.main, resultHandler: { (result, error) in
if let error = error {
debugPrint("testAppsyncQuery Error fetching data: \(error)")
return
}
if let data = result?.data {
// Process your data here
debugPrint("testAppsyncQuery Fetched data: \(data)")
}
})
}
getting a response like this
testAppsyncQuery Fetched data: Data(snapshot: [\"getMonthSalesDetails\": nil])
Can anyone please help on this? Why I'm getting this error?
Upvotes: 0
Views: 19