On iPhone, how do I check once per day to see if i should phone-home?

Posted by Jann on Stack Overflow See other posts from Stack Overflow or by Jann
Published on 2010-06-02T21:11:43Z Indexed on 2010/06/02 22:34 UTC
Read the original article Hit count: 213

Filed under:
|
|
|

I want to check a file on the server only once each day (NSURL). And, no matter if I fetch the file or not, I do not run the function (to check for the file) again that day.

This would SEEM easy... but I forsee issues. Say I had created a directory under the mainBundle: "/Library/runOnceEachDay/". Perhaps I could write to /Library/runOnceEachDay/20100601 knowing that file would only exist if I already ran the function. If it does not exist, run the function and after the function is successful write a zero length file with the date as the filename. Then check before running that function for "mainBundle/Library/runOnceEachDay/YYYYMMDD" whereas YYYYMMDD is today's date. If that file exists, do not run.

I could run a housecleaning routine to clean that directory once/week or something. Any better ideas?

Thanks!

© Stack Overflow or respective owner

Related posts about iphone

Related posts about iphone-sdk