As all other methods did not work, i updated my app in a way that saves all data of the currentInstallation
in a backup table.
PFObject *backupInstallation = [PFObject objectWithClassName:@"installationRecovery"];
for (NSString *key in [PFInstallation currentInstallation].allKeys) {
// Filter out the basic keys.
if (![@[@"objectId", @"createdAt", @"updatedAt"] containsObject:key]) {
[backupInstallation setObject:[PFInstallation currentInstallation][key] forKey:key];
}
}
[backupInstallation saveInBackground];
After i got all installation entries, i manually added the missing ones to the Installation
table. Although the objectId
´s did not match the ones in the local entries, i got the push notifications to work.
You can also handle the copy job by writing a cloud function that does it for you. This could be triggered in a post save hook of installationRecovery
.
I also made shure that this code only executes once on update. By checking a user default setting.
NSString *backuppedInstallation = [[NSUserDefaults standardUserDefaults] boolForKey:@"backuppedInstallation"];
if (!backuppedInstallation) {
// Your code here
[[NSUserDefaults standardUserDefaults] setBool:@(YES) forKey:@"backuppedInstallation"];
[[NSUserDefaults standardUserDefaults] synchronize];
}