Description
I'm running the latest 2.2.6 parse server with an iOS app written in swift and I'm running into an occasional bug where the server seems to delete a valid installation from the database.
e.g. an installation that originated in the iOS client with the following code:
let installation = PFInstallation.currentInstallation()
installation.setDeviceTokenFromData(deviceToken)
installation.saveInBackground()
I can't pin what exactly causes this issue to occur as it's an edge case. But unfortunately it renders my app pretty unusable for any affected user.
I've searched the issues here and can't see any other reports of this issue. Is it one that you're aware of? I'm guessing that it occurs in the RestWrite class somewhere as there are a few references in there to installations getting destroyed...
As a workaround, what I'd like to do it revoke the session of any effected users when this happens. Is that possible in the server code? I can't find any documentation that describe how to do so?
I can detect the issue in iOS as follows:
let installation = PFInstallation.currentInstallation()
installation.setDeviceTokenFromData(deviceToken)
installation.saveInBackgroundWithBlock { (succeed, error) -> Void in
if (succeed) {
}
else if let error = error {
if error.domain == PFParseErrorDomain {
if error.code == PFErrorCode.ErrorObjectNotFound.rawValue {
print("What happened to the installation???")
}
}
}
}
But there also seems to be no way to get the client to re save a new PFInstallation.currentInstallation(). Any ideas if this is even possible?
Telling the user they need to delete and reinstall the app isn't ideal...
Thanks
Nick