views:

297

answers:

0

Location aware app design

I am trying to design and app which does following flow: 1. App starts 2. User can do many different tasks (encapsulated in various view controllers), one of task adds a record to the db 3. I want newly added record in DB contain lat/long for the current location

The problem is that current location may not be yet available when record is added to the DB (of course once it become available the location delegate will get called).

How should I architect the application to account for possibility of valid lat/long missing at the time of record insertion?

The one way I can do it:

  1. Maintain array of primary keys of record with missing valid lat/long
  2. In the location delegate I can walk the array and update records with missing lat/long

Is there any simpler approach? The way I am planning to find out that lat/long are not yet valid, is tracking the delegate call (I will assume that lat/long are not valid BEFORE delegate is called first time). Is this is a correct way?

Thanks