-
-
Notifications
You must be signed in to change notification settings - Fork 877
objectWithClassName:dictionary: wasn’t encoding the dictionary into PFOject properly #947
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
objectWithClassName:dictionary: wasn’t encoding the dictionary into PFOject properly #947
Conversation
Thank you for your pull request and welcome to our community. We require contributors to sign our Contributor License Agreement, and we don't seem to have you on file. In order for us to review and merge your code, please sign up at https://code.facebook.com/cla - and if you have received this in error or have any questions, please drop us a line at [email protected]. Thanks! |
Thank you for signing our Contributor License Agreement. We can now accept your code for this (and any) Facebook open source project. Thanks! |
The problem with this approach is that this constructor should mutate the object and keep it |
Let me know what you think about using that approach. Requesting changes so it's back into your queue, since it's failing tests... |
Thanks @nlutsenko that makes sense, I'll make the change. |
@@ -1634,7 +1634,9 @@ + (instancetype)objectWithClassName:(NSString *)className { | |||
|
|||
+ (instancetype)objectWithClassName:(NSString *)className dictionary:(NSDictionary *)dictionary { | |||
PFObject *object = [self objectWithClassName:className]; | |||
[object _mergeAfterSaveWithResult:dictionary decoder:[PFDecoder objectDecoder]]; | |||
[dictionary enumerateKeysAndObjectsUsingBlock:^(id key, id obj, BOOL *stop) { | |||
object[key] = [[PFDecoder objectDecoder] decodeObject:obj]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: You can save some method invocations by using a single local variable for storing the decoder. Feel free to leave as is, as it's super nitpicking.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
+1 nitpicking is important, shouldn't have missed that, my bad. Didn't think it should be __block since we're not modifying the var. Thanks for the quick feedback.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yup, shouldn't be __block
, as it doesn't' change by the block.
Looks great now.
Awesome, this is good to go, just need for all the tests to finish running... |
Date type properties are not being converted.
more details here:
#945