small medium large xlarge

Back to: All Forums  Core Data
Generic-user-small
05 May 2010, 15:36
Weldon Wiyninger (2 posts)

My application allows users to enter a USA address (street address, city, state, ZIP) and once all these are entered a background thread sends the address to Yahoo’s Geocoding service that returns a latitude/longitude pair to displayed in a transient attribute geoCoordinates. This service takes at least a second or two depending on latency and is therefore too costly to recalculate every time the data is reloaded from the persistent store. On page 97 of the book, under the section Expensive Calculations, it is recommended that time-consuming calculations should be persisted in Core Data but no specific example is given. Is there a particular example in the various projects provided for the book that implement this?

Avatarsmall_pragsmall
05 May 2010, 21:33
Marcus S. Zarra (284 posts)

This is a perfect example of an expensive calculation. In this case I would have two floats in your address object for lat and long. Give them an out of bounds default value (like 1000) so you know when they have not been set.

You must be logged in to comment