Microsoft Sync. Framework with Azure on iOS

Posted by Richard Jones on Geeks with Blogs See other posts from Geeks with Blogs or by Richard Jones
Published on Tue, 19 Jun 2012 23:18:44 GMT Indexed on 2012/06/20 3:17 UTC
Read the original article Hit count: 249

Filed under:
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: , , , ,

© Geeks with Blogs or respective owner