Parse-Swift: ParseInstallation does not store object ID in key-value store

Assume a struct MyParseInstallation conforming to ParseInstallation.

If I understand the code correctly, calling MyParseInstallation.current?.save { (result: Result<AppInstallInfo, ParseError>) in [...] } intends to persist the ParseInstallation data to the server.

However, calling MyParseInstallation.current?.fetch(completion: { (result: Result<AppInstallInfo, ParseError>) in [...]} always returns a failure.

Problem seems to be that objectId of MyParseInstallation is not persisted to the ParseKeyValueStore. Thus, the fetch returns ParseError(code: ParseSwift.ParseError.Code.unknownError, message: "Cannot fetch an object without id")

Another effect of not storing objectId in the key-value store is that multiple calls to MyParseInstallation.current?.save result in multiple ParseInstallation objects being created on the server, all with the same data but different ids.

Tested on both the latest release and the removeDispatch branch.

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Comments: 31 (25 by maintainers)

Most upvoted comments

Just tested again with release 1.3.0 and I think ParseInstallation.current?.fetch does indeed work correctly now. I do not fully understand what went wrong the last time I checked but assume an error on my side. @cbaker6 Thank you for all the time you are investing into this project!

Besides removing “DispatchQueue” from around Installation was there anything else you had to do?

I did not change anything else than removing the additional dispatch after logout before accessing installation.

As mentioned before I completely erased my existing state in the simulator for a fresh start after that.

Thank you for your work and time @cbaker6 ❤️

I use ParseSwift 1.3.0 now. I can successfully login / logout with authenticated users and anonymous users without seeing any issues. Saving ParseInstallation.current works as expected in all cases. My code does not contain any ParseInstallation.current?.fetch calls though.