Adopted from the Files playground. Instead of the ParseFile profilePicture property I created a property that links to a PFPhoto object with nested ParseFiles:
struct GameScore: ParseObject {
var objectId: String?
var createdAt: Date?
var updatedAt: Date?
var ACL: ParseACL?
var originalData: Data?
//: Your own properties.
var points: Int? = 0
var photo: PFPhoto?
}
struct PFPhoto: ParseObject {
//: These are required by ParseObject
var objectId: String?
var createdAt: Date?
var updatedAt: Date?
var ACL: ParseACL?
var originalData: Data?
//: Your own properties.
var photo: ParseFile?
var thumbnail: ParseFile?
var location: ParseGeoPoint?
}
I then save a Score that contains the PFPhoto:
var score = GameScore(points: 52)
//: Set the link online for the file.
let linkToFile = URL(string: "https://parseplatform.org/img/logo.svg")!
//: Create a new `ParseFile` for your picture.
//: Set the picture as part of your ParseObject
let photoFile = ParseFile(name: "profile.svg", cloudURL: linkToFile)
let thumbnailFile = ParseFile(name: "profile.svg", cloudURL: linkToFile)
var pfPhoto = PFPhoto()
var photoACL = ParseACL()
photoACL.publicRead = true
photoACL.publicWrite = false
photoACL.setWriteAccess(user: User.current!, value: true)
pfPhoto.ACL = photoACL
pfPhoto.photo = photoFile
pfPhoto.thumbnail = thumbnailFile
score.photo = pfPhoto
do {
try await score.save()
}
catch{
print(error.localizedDescription)
}
❌ Please edit your post and use the provided template when creating a new issue. This helps everyone to understand your post better and asks for essential information to quicker review the issue.
Issue Description
Deep save of ParseFile creates invalid file.
Steps to reproduce
Adopted from the Files playground. Instead of the ParseFile profilePicture property I created a property that links to a PFPhoto object with nested ParseFiles:
I then save a Score that contains the PFPhoto:
Actual Outcome
When I save a score object, the PFPhoto object is saved but the ParseFiles link to invalid data- https://parsefiles.back4app.com/zgqRRfY6Tr5ICfdPocRLZG8EXK59vfS5dpDM5bqr/thumbnail.jpg
Expected Outcome
The PFPhoto object should contain two valid image files.
Environment
Client
Server