-3

Possible Duplicate:
Internal clock in iPhone background mode

I am developing an iPhone application which involves Ticket Booking System. I registered my application as location based beacuse it is using user's location taken in background for a purpose.

My problem is that i need to run an internal clock in my application in background mode. I need to write the codes for internal clock in core location delegate methods, so that internal clock will also run along with the location bsed services. Will my app get rejected? Is anything wrong in doing like this?

I need to get the correct time to use in my app, so that i am running this internal clock. I can use NSDate, but that will return the device time. Anyone can change the device time. So once somebody chaged, wrong time will affect the smooth functioning of the app. Kindly some body suggest to get the correct time with out running the internal clock ?

Community
  • 1
  • 1
Praveen
  • 301
  • 2
  • 11
  • 2
    Are you going to ask this same question any more times? http://stackoverflow.com/questions/9564823/internal-clock-in-iphone-background-mode – Nick Bull Mar 14 '12 at 10:19
  • i am not getting the correct answer or good suggestions...and i am in a big trouble too... – Praveen Mar 14 '12 at 11:34

1 Answers1

1

You can't in background mode.

The only way the device knows what time it is is when the user tells it (yes, there's automatic time updates but that can just be turned off)

If you wanted to know the 'actual' tone, you would have to ask an external source (I guess your server) while your app was running.

However, you might be able to keep track of the time by recording the time stamp each time the location is found in the background. Then when your app is started you can compare them all; if they look odd, compensate for the clock change.

deanWombourne
  • 38,189
  • 13
  • 98
  • 110
  • Thanks for understanding my problem... But finding odd one among timestamps will be difficult.Because we can easily find an odd time if it is before our current time, but if the changed time is after the current time,it would be difficult or not possible.Will my app get rejected if i run an internal clock in bg along with location based services?Another problem i am facing is that,if the user quits the app from bg by clicking the red button, then this clock will also stop.Am i correct? Do u have any suggestion to get the correct time in offline mode? – Praveen Mar 14 '12 at 11:50
  • Sorry, you're just going to have to hope that the user doesn't change the time too much :) Like you said, you can repair it if the time is changed back; you'll just have to hope it's not moved forwards :) – deanWombourne Mar 14 '12 at 12:11
  • :( Any option to know if time changed and how much it changed...any methods? – Praveen Mar 14 '12 at 12:32
  • Not that I know of, sorry. I've run into this problem before as well and couldn't find a solution that didn't need an external server of some sort to sync with. – deanWombourne Mar 14 '12 at 12:55
  • k...please inform if u get some idea on this....thanks – Praveen Mar 14 '12 at 14:05