I'm trying to store objects in a local Parse datastore on the device itself. I get an error when retrieving the stored object: 'Method requires Pinning enabled.'
I've implemented 'Parse.enalbelLocalDatastore() in AppDelegate.swift. I tried to hard-code the object to be sure there was an object to retrieve.
let configuration = ParseClientConfiguration
{
$0.applicationId = "..."
$0.clientKey = "..."
$0.server = "..."
}
Parse.enableLocalDatastore()
Parse.initialize(with: configuration)
...
func blancoUser() {
let object = PFObject(className: "UserData")
object["id"] = (UUID().uuidString)
object["LoginName"] = "userName"
object["PinCode"] = "00000"
object["ScreenName"] = "test"
object["YearOfBirth"] = 0
object.pinInBackground()
}
...
let query = PFQuery(className: "UserData")
var users:[UserData] = [UserData]()
query.fromLocalDatastore()
query.findObjectsInBackground { (objects: [PFObject]?, error: Error?) in
if let error = error {
print(error.localizedDescription)
} else if let objects = objects
I want to get the variable 'users' with the locally stored user objects. What am I missing? Or does the ParseLocalDatastore work differently in SwiftUI.