Skip to content

object.createdAt is nil but object["createdAt"] is not #422

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

Closed
xissburg opened this issue Oct 15, 2015 · 4 comments
Closed

object.createdAt is nil but object["createdAt"] is not #422

xissburg opened this issue Oct 15, 2015 · 4 comments

Comments

@xissburg
Copy link

This is true for an object that was not yet saved (or is being saved). Here is the output of a debug session:

(lldb) po chatMessage
<ChatMessage: 0x1742ccc50, objectId: new, localId: local_be0ecc71f3af9817> {
    author = "<PFUser: 0x1701192c0, objectId: 1Nii4IsZc1, localId: (null)>";
    body = "The only thing I don't think tha";
    chat = "<Chat: 0x1742d03e0, objectId: o5IWJ2bNq1, localId: (null)>";
    createdAt = "2015-10-15 23:18:38 +0000";
    status = 0;
    updatedAt = "2015-10-15 23:18:38 +0000";
}

(lldb) po chatMessage.createdAt
nil

(lldb) po chatMessage
<ChatMessage: 0x1742ccc50, objectId: new, localId: local_be0ecc71f3af9817> {
    author = "<PFUser: 0x1701192c0, objectId: 1Nii4IsZc1, localId: (null)>";
    body = "The only thing I don't think tha";
    chat = "<Chat: 0x1742d03e0, objectId: o5IWJ2bNq1, localId: (null)>";
    createdAt = "2015-10-15 23:18:38 +0000";
    status = 0;
    updatedAt = "2015-10-15 23:18:38 +0000";
}

(lldb) po chatMessage.updatedAt
nil

(lldb) po chatMessage["createdAt"]
2015-10-15 23:18:38 +0000
@richardjrossiii
Copy link
Contributor

Thanks for the report, looking into it now.

@richardjrossiii
Copy link
Contributor

I'm unable to reproduce locally, might I ask how you are creating this object?

Nowhere in the client SDK do we manually set createdAt / updatedAt, so the fact that those fields exist at all indicate to me that you may be trying to manually set these fields, which is not supported by the SDK.

@parse-github-bot
Copy link

Thank you for your feedback. We prioritize issues that have clear and concise repro steps. Please see our Bug Reporting Guidelines about what information should be added to this issue.

Please try the latest SDK. Our release notes have details about what issues were fixed in each release.

In addition, you might find the following resources helpful:

@xissburg
Copy link
Author

Ouch, yes, I am setting the dates manually:

chatMessage.setValue(NSDate(), forKey: "createdAt")
chatMessage.setValue(NSDate(), forKey: "updatedAt")

That because I have to display the item immediately after it's created, before it gets saved.

Thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants