What worked for me to get rid of this exception was using saveEventually()
instead of saveInBackground()
.
Here you have a link to my answer to a similar question.
I think that saveEventually()
is a better option because it assures that the installation will always be saved, regardless of the netwwork availability. In contrast, with saveInBackground()
there is a chance that the save fails due to no network connectivity. Also with saveEventually()
you don't need to do any error checking, which you should do in a SaveCallback()
with saveInBackground()
.
Regarding the duplicate notifications, this shouldn't occur if you are using the latest Parse SDK (it doesn't happen to me with 1.7.1). There was a bug that has been solved now. See this SO question and this FB bug.
Note that first time the user receives a notification after reinstalling the app, this notification can be delivered twice. It has happened to me, but only happens for the very first notification. (See the FB link for more details.) After that duplicate notification, the old installation will be removed automatically by Parse. This is my experience.
If you are trying to avoid sending duplicate notifications by implementing some logic at the CloudCode (using a beforeSave that triggers when saving a new Installation, check if the app had already been installed into the device and deleting the old installation), don't do that! There is not need. Parse will do it for you: it will delete the old installation :)