The error will not be saved. Error: The icon must be a non-negative integer.

My problem seems to be almost identical to this one that has never been solved:

https://www.parse.com/questions/installation-not-created

It started when I removed all preferences from the analysis data browser (bad idea, I know this now). The problem is, it won't save any new installations from one of my (real) test devices, presumably due to this confusing error:

Error: badge must be a non-negative integer: -3 (Code: 111, Version: 1.2.20)

      

This happens on a fresh install where I am not doing anything with the icon number yet. To make it even more complex, Parse will save installations from other (real) devices and the simulator. For reference, this is how I try to keep the settings in my AppDelegate.m:

- (void)application:(UIApplication *)application didRegisterForRemoteNotificationsWithDeviceToken:(NSData *)deviceToken {
    // Store the deviceToken in the current installation and save it to Parse.
    PFInstallation *currentInstallation = [PFInstallation currentInstallation];
    [currentInstallation setDeviceTokenFromData:deviceToken];
    [currentInstallation saveInBackground];
}

      

Any ideas?

+3


source to share


1 answer


I still don't know why this error occurred, but the solution seemed to insert the following line of code and then remove it after installation:



[[PFInstallation currentInstallation] setBadge:0];

      

+2


source







All Articles