Microsoft Sync. Framework with Azure on iOS
- by Richard Jones
A bit of a revelation this evening. I discovered something obvious, but missing from my understanding of the brilliant iOS example that ships with the Sync. Framework 4.0CTP
It seems that on the server side if a record is edited, correctly only the fields that are modified gets sent down to your device (in my case an iPad).
I was previously just blindly assuming that I'd get all fields down. I modified my Xcode population code (based on iOS sample) as follows:
+ (void)populateQCItems: (id)dict withMetadata:(id)metadata withContext:(NSManagedObjectContext*) context
{
QCItems *item = (QCItems *)[Utils populateOfflineEntity:dict withMetadata:metadata withContext:context];
if (item != nil) // modify new or existing live item
{
if ([dict valueForKey:@"Identifier"]) // new bit
item.Identifier = [dict valueForKey:@"Identifier"];
if ([dict valueForKey:@"InspectionTypeID"]) // new bit
item.InspectionTypeID = [dict valueForKey:@"InspectionTypeID"];
[item logEntity];
}
}
I hope this helps someone else; as I learnt this the hard way.
Technorati Tags: Xcode, iOS, Azure, Sync Framework, Cloud