So I’ve been converting my existing code running the older Parse iOS SDK to ParseSwift, unfortunately I get this error as I have an Optional parent field for my Location object as Locations can have a parent Location.
The last way I mentioned will save you some lines of code (you can fetch immediately) and your client objects will mirror your schema on the server:
struct Pagina : ParseObject {
var objectId: String?
var createdAt: Date?
var updatedAt: Date?
var ACL: ParseACL?
var titolo: [String: String]?
var parent: Pointer<Pagina>? //This will always have to be a pointer instead of an object. The same way it's represented on the server.
}
But I get this error of it not being a valid pointer.
I’ve printed out the Location Object I have as well below.
**Optional(ParseSwift.Pointer<Lokality.Location>(__type: "Pointer", objectId: "XSGSQOxTon", className: "Location"))**
**Fatal error: Error saving: ParseError(code: ParseSwift.ParseError.Code.incorrectType, message: "This is not a valid Pointer")**
I’ve tried using a full Location object that I queried and pulled from the database, I’ve tried creating a new one (Location(objectId: “Xxxx”)).
Neither has worked. I’m not sure now what to look into on how to get this to recognize it as a Pointer
Seems like the actual object is good. I don’t know what else to do.
Edit: I don’t know if this helps but this is what my Logs show
Jun 18, 2021, 23:07:16 +08:00- ERROR
This is not a valid PointerError: This is not a valid Pointer
at getObjectType (/opt/app-root/src/node_modules/parse-server/lib/Controllers/SchemaController.js:1393:11)
at getType (/opt/app-root/src/node_modules/parse-server/lib/Controllers/SchemaController.js:1317:14)
at SchemaController.validateObject (/opt/app-root/src/node_modules/parse-server/lib/Controllers/SchemaController.js:1084:24)
at loadSchema.then.then (/opt/app-root/src/node_modules/parse-server/lib/Controllers/DatabaseController.js:443:21)
at process._tickCallback (internal/process/next_tick.js:68:7)