-
-
Notifications
You must be signed in to change notification settings - Fork 878
Error: Attempted to change an objectId to one that's already known to the Offline Store #1202
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
Comments
Have same problem :( |
@StratRob when calling a cloud function, the objects should already by hydrated as PFObject’s. Can you confirm that they are indeed not dictionaries? PFObject can be casted as dictionaries as they also conform to subscripting extensions. |
I can confirm we got a new flood of this exact crash when deploying a new version of our app that upgraded from 1.15.3 to 1.15.4, with the associated Bolts upgrade, with no app changes that should have triggered something like this.
Thanks to the Bolts dispatching strategy it's hard to see where in our app this is actually happening, but as we use no cloud functions I don't think it's specific to them. Obviously not enough info for a real diagnosis, but what's your feeling? Might Bolts have changed something bad that screws up the order of some operations? |
Bolts doesn’t swallow exceptions anymore, and I believe this is the reason why we see those now, i’ll Check with an older version if those were properly swallowed before |
I can confirm that all PFConsistencyAssertion were previously caught in Bolts 1.8.* and now bolts don't catch them anymore. We need to properly refactor those code paths to transofrm exceptions into errors which is problematic as it stands. |
@StratRob , @ceramicatheist after much work into putting the SDK on a stable version for the Bolts 1.9.0, this exception is gonna stay, as you're mutating objects from the local datastore. What's happening, is that you're changing the objectId from a known object, in previous versions this would yield an NSInternalInconsistencyException that would be caught by the bolts tasks runner. This is an important error that should not be disregarded. @ceramicatheist would you be able to share some code that would be responsible for this? Do you ever set manually an objectId on an objectWithoutData? |
I did a sweep of our code looking for objectID, and we don't set it anywhere. We do extensively use the local store, but never assign an objectID. I should add (and maybe put in a separate issue?) that this was not the worst of the new crashes we saw. The most frequent was:
Which would occur when we sign up a new user authenticating with Facebook. In the completion block of Postponing that save with an async dispatch was enough to work around that particular problem. I'm sorry, I wish I had nice succinct code snippets to share with you. The way Bolts works, it's very hard to tell which bit of our app is even at fault. |
Ok, if you reliably have that error can you check the latest cocoapods version? 1.17.0-alpha.2. You should lot have the exception but a soft error |
@StratRob I have been looking in depth into your issue, and I believe I found the solution. Your app is crashing because the new instances of PFObject's you're subsequently creating break the 1..1 mapping for the offline in memory cache. There's a potential fix, by changing the implementation of on another note, the objects in response to a PFCloud.runFunction call should contain the PFObjects, and I'M more enclined making sure that's the case. Can you double check that it isn't the case? @ceramicatheist any chance you can isolate the call that yields that issue on merge? |
@StratRob after further invesigation, I can confirm that if CloudCode returns proper Parse Object's they are already exposed as-is in the results. You don't need your initializer.
This code should work. I'll be closing the issue now. @ceramicatheist @iThinkersTeam I encourgage both of you to open a new issue. |
@flovilmart |
@ananfang what issue do you mean? You can use LiveQuery on branch 'release-2.4.0' (parse-community/ParseLiveQuery-iOS-OSX#151) it's compatible with the latest Parse SDK alpha |
@flovilmart After changing Parse to branch 'release-1.17.0' and ParseLiveQuery to branch 'release-2.4.0', it will not crash the app, thanks for your effort. |
@ananfang it doesn,t crash anymore but the operation errors :) |
@flovilmart The error message shows that: Followings are my codes to save a Parse object with class name Story:
There is a Live Query listen to this story (created, updated, entered and deleted) |
@flovilmart Should be |
@flovilmart In the function |
* 1. Fix typo PFPreconditionFailOnError and PFPreconditionFailAndSetError. 2. If there is a new object in OfflineStore, should not send the exception when the saved object update its OfflineStore cache * Change the condition about newly saved object * fix typo * Revert to PFPreconditionBailOnError and PFPreconditionBailAndSetError
Hooray, I look forward to trying this out in our app and finally advancing from 1.15.3. Are pre-built frameworks no longer available? |
They should be |
1.6.0 is the last tag with downloadable frameworks under it - everything since just has source code.
I apologize if I’m looking in the wrong place
… On May 29, 2018, at 2:39 PM, Florent Vilmart ***@***.***> wrote:
They should be
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub, or mute the thread.
|
Nope, you’re right my bad. They were supposedly automated, but it seems that it didn’t work as expected |
Coming back a little bit late, but thank you very much for the help and explanation! |
Hi everyone,
I'm having a regular issue with my project, using Parse Server. First, I call a Parse Cloud function to populate a user's data list :
On the code mentioned above, I have to set the objectId because without this, no matter how many objects I fetch from Parse, when I reduce the array to a set with the last instruction I end up with only one object in it.
However, although this works, when I call this function again to update user's data, I get this error on the
myData.dataSource?.objectId = temp["objectId"] as? String
line :Any idea? Thanks for your help.
The text was updated successfully, but these errors were encountered: