Skip to content
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

Apparent caching issue with Array of Custom Objects stored in Custom Object #518

Closed
craiggrummitt opened this issue Nov 5, 2015 · 6 comments

Comments

@craiggrummitt
Copy link

There seems to be some sort of caching issue with an Array of Custom Objects. I have included a link to a bare bones example of this problem. Let me describe the bare bones app, then the issue:

App:
Simple chat app with one channel, only functionality is displaying all messages, and add message. I have a custom class 'Message' and 'Chat' (which stores an array of Messages). Messages are displayed in a UITableView, and there is a button to 'reload' the chat using a query. The query uses 'includeKey' to ensure that the messages array is included. When the app starts up, if no chat exists, it creates one with a blank messages array.

The only changes to this app from the Parse Starter Project are: Chat.swift, Message.swift, AppDelegate.swift(to set the application id and register subclasses), ViewController.swift and the storyboard.

Problem:
The query seems to retrieve cached data (i.e. it doesn't update with updates in the data).

From my testing, the device that generates the 'Chat' object initially does not present this problem. However, the device that did not initially generate the 'Chat' object, does present this problem.

Steps to produce this problem:

  1. Download the sample code here.
  2. You will need two devices. Install the app on first device(Device A). Note that as the query came back with no 'Chat' objects that it generated one. Double check in Parse Core that this 'Chat' object was generated.
  3. Run the app on the other device (Device B) This time the query comes back with a Chat object.
  4. Add a message on Device A by tapping the plus button and then save. Note this saves the message, and then reloads the query and the table. Double check the message was saved in Core.
  5. Reload the table on Device B - message should appear. Great!
  6. Add a message on Device B, same as step 3. The message should be returned by the query. Double check the message was saved in Core.
  7. Reload the table on Device A - huh? The message doesn't appear. Triple check the message was saved in Core. It was right? Why doesn't the query return it?
  8. Scratch head.
  9. Build and run the app on Device A again - now the message does appear. What the? Is this a caching problem?

Additional diagnostic notes:
In my actual app I had implemented a limit of 20 messages, and after that the first message was deleted. I noticed that after I started deleting messages, that this apparent caching problem stopped occurring.

@richardjrossiii
Copy link
Contributor

Thanks for the detailed report. This may be related to mutable containers, see #102. That feature is getting removed in the next release of the SDK.

I'll investigate further however, and see if I can't figure this one out.

@craiggrummitt
Copy link
Author

Thanks @richardjrossiii , even a workaround would be great.

@richardjrossiii
Copy link
Contributor

Confirmed that this no longer happens with the mutable containers fix in place. As a workaround until the next SDK release is out, please ensure that using latest master fixes this for you. If it doesn't work, feel free to reopen the issue with any more info you can find.

Thanks for the concise, reproducible report & sample project too!

@craiggrummitt
Copy link
Author

Thanks @richardjrossiii , I'm back now after falling down a rabbit hole of disabling System Integrity Protection so I could install bundle so I could compile the framework so I could test the framework compiled from the master branch in my test code, and it works!

When integrating it with my actual project I found apparent incompatibilities between the Parse framework and ParseFacebookUtilsV4 - it was trying to #import <Parse/PFNullability.h> which no longer appears to exist. After merely commenting out this import(could you confirm this is the correct solution - I couldn't find info on this) the newly compiled framework also seems to resolve the issue in my project, hooray! Thanks for your good work.

@nlutsenko
Copy link
Contributor

@craiggrummitt Yup, that solution works great. Current master of ParseFacebookUtilsV4 has it removed, so it's no longer needed and removal will be included in the next release.

@craiggrummitt
Copy link
Author

Great! Thanks for the reply @nlutsenko

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

3 participants