Skip to content
Open
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions Parse/Parse/Source/PFDecoder.m
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,13 @@ - (id)decodeDictionary:(NSDictionary *)dictionary {
}

NSString *type = dictionary[@"__type"];
// Inject __type = @"Object" if missing but className/objectId present
if (!type && dictionary[@"className"] && dictionary[@"objectId"]) {
NSMutableDictionary *mutable = [dictionary mutableCopy];
mutable[@"__type"] = @"Object";
type = @"Object";
dictionary = mutable;
}
if (type) {
if ([type isEqualToString:@"Date"]) {
return [[PFDateFormatter sharedFormatter] dateFromString:dictionary[@"iso"]];
Expand Down
1 change: 0 additions & 1 deletion ParseLiveQuery/ParseLiveQuery/Internal/ClientPrivate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ private func parseObject<T: PFObject>(_ objectDictionary: [String:AnyObject]) th
guard let _ = objectDictionary["objectId"] as? String else {
throw LiveQueryErrors.InvalidJSONError(json: objectDictionary, expectedKey: "objectId")
}

guard let object = PFDecoder.object().decode(objectDictionary) as? T else {
throw LiveQueryErrors.InvalidJSONObject(json: objectDictionary, details: "cannot decode json into \(T.self)")
}
Expand Down