Skip to content

Updating a saved ParseObject using saveAll produces error #405

@vdkdamian

Description

@vdkdamian

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:

struct PGRListItem: NVMParseObject {
    var objectId: String?
    var createdAt: Date?
    var updatedAt: Date?
    var ACL: ParseACL?
    var originalData: Data?
    
    var id: String { 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?
    
    init() {
        self.nvmId = Novem.generate_nvmId()
    }
}

Here is my code that saves the objects.

if let synchronizableObject = synchronizableObjects.first, synchronizableObjects.count == 1 {
    let object = try await synchronizableObject.save()
    
    self.removeSynchronizingObject(object.nvmId)
    try self.storeParseItems([object],
                             storeGroup: self.storeGroup,
                             encryption: self.encrypted ?? false,
                             fetch: .none)
    
} else {
    let results = try await synchronizableObjects.saveAll()
    try self.storeResults(results,
                          storeGroup: self.storeGroup,
                          encryption: self.encrypted ?? false)
}

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

  • Parse Swift SDK version: 4.10.0
  • Xcode version: 14.0 beta 6
  • Operating system (iOS, macOS, watchOS, etc.): iOS, macOS
  • Operating system version: iOS 16, macOS 13

Server

  • Parse Server version: 4.5.0
  • Operating system: Back4app
  • Local or remote host (AWS, Azure, Google Cloud, Heroku, Digital Ocean, etc): Back4app

Database

  • System (MongoDB or Postgres): MongoDB
  • Database version: 3.6
  • Local or remote host (MongoDB Atlas, mLab, AWS, Azure, Google Cloud, etc): Back4app

Logs

Metadata

Metadata

Assignees

No one assigned

    Labels

    type:bugImpaired feature or lacking behavior that is likely assumed

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions