Parse-Swift icon indicating copy to clipboard operation
Parse-Swift copied to clipboard

`saveAll` doesn't handle pointers

Open dblythy opened this issue 2 years ago • 3 comments

New Issue Checklist

Issue Description

Parse Swift doesn't properly convert Parse Object to Pointers on .saveAll, leading to schema mismatch errors.

Steps to reproduce

var parent = Parent()
parent.name = "name"
do {
            let response = try parent.save()
            let children = childObjects.map{ obj -> Child in
                obj.parent = response
                return obj
            }
            try children.saveAll()
            print("\n\n\n all saved")
        } catch let error {
            print(error)
        }

Actual Outcome

Schema mismatch, expected Pointer<Parent> received object. Errors are not thrown using children.first.save()

Expected Outcome

Objects to save.

Environment

Client

  • Parse Swift SDK version: 4.7.0
  • Xcode version: 13.4.1
  • Operating system (iOS, macOS, watchOS, etc.): macOS
  • Operating system version: 12.2

Server

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

Database

  • System (MongoDB or Postgres): mongodb

Logs

dblythy avatar Aug 10 '22 04:08 dblythy

Thanks for opening this issue!

  • 🚀 You can help us to fix this issue faster by opening a pull request with a failing test. See our Contribution Guide for how to make a pull request, or read our New Contributor's Guide if this is your first time contributing.

On the latest versions of iOS 16 and macOS, saveAll is actually broken.

vdkdamian avatar Aug 10 '22 04:08 vdkdamian

In your example, please add more details for your ParseObjects along with using async/await or completion blocks instead of synchronous calls as sync calls will be deprecated and shouldn’t be used when making networking calls.

cbaker6 avatar Aug 10 '22 10:08 cbaker6

You're awesome @cbaker6 👏

dblythy avatar Aug 18 '22 01:08 dblythy

Thanks for reporting the issue!

cbaker6 avatar Aug 18 '22 14:08 cbaker6