-
-
Notifications
You must be signed in to change notification settings - Fork 69
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
Updating a saved ParseObject using saveAll produces error #405
Comments
Thanks for opening this issue!
|
I'm not able to replicate your issue. Some notes:
I recommend:
|
In addition, I suspect: init() {
self.nvmId = Novem.generate_nvmId()
} is related to your issue based on
and Parse-Swift/ParseSwift.playground/Pages/1 - Your first Object.xcplaygroundpage/Contents.swift Lines 55 to 66 in a94ac8c
Your struct PGRListItem: NVMParseObject {
var objectId: String?
var createdAt: Date?
var updatedAt: Date?
var ACL: ParseACL?
var originalData: Data?
/*
I highly doubt you need this here and you probably have to manage more
code in the long run because you have it here. If you really want it, it should look
more like the following. Your nvmId will only get used when there's no objectId (basically
when the ParseObject hasn't been saved to the server).
*/
// var id: String { objectId ?? nvmId ?? Novem.generate_nvmId() }
var userId: String?
var nvmId: String?
var timeStamp: Date?
var deviceId: String?
var deviceName: String?
var selected: Bool?
var shops: [Shop]?
var brand: String?
var priority: Int?
var amount: Float?
var price: [String : String]?
var checkedHistory: [Date]?
var uncheckedHistory: [Date]?
var checkedTimes: Int?
var uncheckedTimes: Int?
var lastUsed: Date?
}
/*
It is recommended to place custom initializers in an extension
to preserve the memberwise initializer.
*/
extension PGRListItem {
init(nvmId: String?) {
self.nvmId = nvmId ?? Novem.generate_nvmId()
}
} |
I totally forgot I can't use custom init(). But my custom ID is for the exact reason as you mention. I had an issue where I needed the ID on objects that where not saved yet. I'll try to reform all the mess I made later today. |
I completely removed the custom init, and the custom id var. It still shows the error. |
I'll do.
It's not a |
I don't know how to connect the Playgrounds to my server. Is there a tutorial or something? |
This is discussed In CONTRIBUTING.md and towards the top of README.md. |
I'm having the exact issue. saveAll() works for new objects (object never saved to Parse server yet) but doesn't work for modifying existing objects (object already exists on the Parse Sever). Below is the log from Parse Sever when saveAll() is used to save existing objects. You can see that the
When saving new objects with saveAll() the log from Parse Server looks like this:
The Digging into the source code, it looks the culprit is from this line
For new objects, it goes to the line
|
Fix is working! Thanks |
@bcbeta can you provide the code for your objects and your call to save? It's best to edit the Playgrounds examples and make it produce the error as mentioned here: #405 (comment). From the example you described:
The relevant playgrounds code seems to work in my testing of the latest version: Parse-Swift/ParseSwift.playground/Pages/8 - Pointers.xcplaygroundpage/Contents.swift Lines 101 to 140 in dc7666f
Also, if you are using |
Yes sorry I deleted my comment because I need to spend a little more time describing the issue. I’ll try to get to it tonight. Something with the latest update broke my apps ability to save objects. |
This is unfortunate. I ran the whole Playgrounds suite along with the CI test suite and didn't see any breaks. Feel free to open a new issue if you discover how to replicate the problem you are facing. |
New Issue Checklist
Issue Description
I am unable to upload objects using the
saveAll()
method. I get the error:"ParseError code=105 error=Invalid field name: __type."
This is my struct:
Here is my code that saves the objects.
Also might be important, if only one object needs to be saved, my code makes use of
.save()
. Multiple objects use.saveAll()
. It's good to know that the.save()
function never throws this error.Steps to reproduce
Using the saveAll() method
Actual Outcome
ParseError code=105 error=Invalid field name: __type.
Expected Outcome
No error
Environment
Client
4.10.0
14.0 beta 6
iOS, macOS
iOS 16, macOS 13
Server
4.5.0
Back4app
Back4app
Database
MongoDB
3.6
Back4app
Logs
The text was updated successfully, but these errors were encountered: