After months and months I really am out of ideas now on how I can keep my app's saved data in sync. The app saves its data (fillable certificates) into a table view from core data
. The user fills out the relevant details in UITextFields
and can save these certificates to the device into a UITableView
The NSMutableArray
for the UITableView
data is self.certificates
Loading data into table view
- (void)loadData
{
ICContractorManager *contractorManager = [ICContractorManager manager];
NSError *error = nil;
Contractor *contractor = [contractorManager primaryContractor:&error];
if (contractor == nil || error != nil) {
DebugLog(@"Failed to fetch contractor");
if (error != nil) {
DebugLog(@"Error: %@", error.localizedDescription);
}
}
else {
NSSortDescriptor *sortDescriptor = [[NSSortDescriptor alloc] initWithKey:@"modifiedAt" ascending:NO];
NSArray *sortDescriptors = [[NSArray alloc] initWithObjects:sortDescriptor, nil];
//Certificate data
self.certificates = [[contractor.certificates sortedArrayUsingDescriptors:sortDescriptors] mutableCopy];
}
[self.tableView reloadData];
NSLog(@"LOAD CERT DATA %@",contractor.certificates); <-----logs data of certificates ok
}
What im trying to achieve:
- To sync the table data between devices
- As this seems seems to be eluding me id settle for a least a manual back up and restore option.
What have I tried...For the sake of brevity this is a brief version
- The usual research on Google and SO (months not days on and off)
- Using nice class called PersistentStack. Imagine my joy when this effortlessly synced my data. This was not to last as duplicates began appearing in other areas of my app that were unwanted.
It was then I reached out to Apple who told me to come up with my own algorithm to prevent duplicate initially. I explained to them that the reason I was using a TSI was I could use some advice for that very purpose. After 2 months we got no where and gave up on that one.
Now with Cloud Drive i'm even more confused. - So now things are getting more desperate and I try what I hoped would be a simpler approach by using Airdrop to send the data between devices in some sort of manual unelegant workaround. Some very helpful advice from Austin here: Send NSArray Via AirDrop got somewhere close, however the file created could not be recognised by app on the target device,although sending it to mac via airdrop and opening it up in a text editior showed at least some form of data resembling my core data array.
What i'm hoping to achieve from this question
Options and advice of how to keep this table view data in sync with other devices or somehow get this data off one device and put on another by any means necessary! save to Parse? Carrier pigeon?