While using Apollo iOS 0.29.1, I appear to be running into an issue similar to the one reported here. I asked for help with this issue in Spectrum, and @designatednerd asked me to create a new issue.
I'm trying to update the SqlNormalizedCache (which is setup and working properly) using the result of a successful mutation operation:
apollo.perform(mutation: InsertTaskResponseMutation(taskId: 1, response: "")) { result in
guard
let resultData = try? result.get().data,
let taskResponseDetails = resultData.insertTaskResponses?.returning.first?.fragments.taskResponseDetails
else {
return
}
apollo.store.withinReadWriteTransaction({ transaction in
try! transaction.write(object: taskResponseDetails, withKey: "task_responses-\(taskResponseDetails.id)")
})
}
This is throwing a fatal error in "JSONStandardTypeConversions.swift" at line 109:

Printing the description of self:
Printing description of self:
▿ Optional<Any>
- some : 07/08/2020
In this case, self is a property on the response property, which is a custom jsonb type. Here's the type alias:
public typealias jsonb = [String : Any?]
extension Dictionary: JSONDecodable {
public init(jsonValue value: JSONValue) throws {
guard let dictionary = value as? Dictionary else {
throw JSONDecodingError.couldNotConvert(value: value, to: Dictionary.self)
}
self = dictionary
}
}
And here's the query:
query ChallengeTaskResponse($taskResponseId: Int) {
challenge_responses(where: {id: {_eq: $taskResponseId}}) {
...ChallengeTaskResponseDetails
}
}
The mutation:
mutation InsertTaskResponse($response: jsonb) {
insert_task_responses(objects: {response: $response}) {
returning {
...TaskResponseDetails
}
}
}
And, finally, the fragment that's used by both the query and the mutation:
fragment TaskResponseDetails on task_responses {
id
response // The 'jsonb' custom data type
}
While using Apollo iOS 0.29.1, I appear to be running into an issue similar to the one reported here. I asked for help with this issue in Spectrum, and @designatednerd asked me to create a new issue.
I'm trying to update the SqlNormalizedCache (which is setup and working properly) using the result of a successful mutation operation:
This is throwing a fatal error in "JSONStandardTypeConversions.swift" at line 109:
Printing the description of
self:In this case,
selfis a property on theresponseproperty, which is a customjsonbtype. Here's the type alias:And here's the query:
The mutation:
And, finally, the fragment that's used by both the query and the mutation: