-
-
Notifications
You must be signed in to change notification settings - Fork 875
Closed
Description
Example input dictionary:
{
"confirmationId": "AWKMhXX",
"data" : {
"bookingType": "LB_Access_Entry";
"units": 1,
"user" : {
"name": "new entry person"
}
},
"loungeId": "LB_HQ",
"reservationTime":{
"__type":"Date",
"iso": "2016-06-22T01:37:00.000Z"
}
}
Running it through + (instancetype)objectWithClassName:(NSString *)className dictionary:(NSDictionary *)dictionary
Output:
<LBReservation: 0x7f8132d22850, objectId: new, localId: (null)> {
confirmationId = AWKMhXX;
data = {
bookingType = "LB_Access_Entry";
units = 1;
user = {
name = "new entry person";
};
};
loungeId = "LB_HQ";
reservationTime = {
"__type" = Date;
iso = "2016-06-22T01:37:00.000Z";
};
}
Note - reservationTime is just saved as a dictionary instead of converted to NSDate as expected.
There's a straightforward fix of changing its implementation to:
+ (instancetype)objectWithClassName:(NSString *)className dictionary:(NSDictionary *)dictionary {
return [self _objectFromDictionary:dictionary defaultClassName:className completeData:YES];
}
instead of using a naive assignment as it is doing right now
[dictionary enumerateKeysAndObjectsUsingBlock:^(id key, id obj, BOOL *stop) {
object[key] = obj;
}];
If there aren't any other considerations that I somehow missed I can make a PR with those changes.
Thanks!
Metadata
Metadata
Assignees
Labels
No labels