Skip to content

Commit 18003b0

Browse files
committed
Workaround to fix parsing when afterLiveQueryEvent is active on server
1 parent 6cfad53 commit 18003b0

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

ParseLiveQuery/ParseLiveQuery/Internal/ClientPrivate.swift

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,10 @@ private func parseObject<T: PFObject>(_ objectDictionary: [String:AnyObject]) th
1919
throw LiveQueryErrors.InvalidJSONError(json: objectDictionary, expectedKey: "objectId")
2020
}
2121

22-
guard let object = PFDecoder.object().decode(objectDictionary) as? T else {
22+
//workaround to fix missing __type key Decoder expects with value "Object"
23+
var dict = objectDictionary
24+
dict["__type"] = String("Object") as AnyObject
25+
guard let object = PFDecoder.object().decode(dict) as? T else {
2326
throw LiveQueryErrors.InvalidJSONObject(json: objectDictionary, details: "cannot decode json into \(T.self)")
2427
}
2528

0 commit comments

Comments
 (0)