I have a button in my iOS app when I hit this button it will do this:
So sometime when my server lag or slow the app will download when the 1st step isn't done yet, maybe I need a way to delay the code or anyway I can check the file whether it's complete the conversion from MySQL to SQLite file ?
thx a bunch for every answers : )
ASIHTTPRequest to your servers. Your app will hang and wait until server finishes with the request and returns the file.
ASIHTTPRequest if you want to download the connent in the background.
one way is to do something like this
unlink sqlite.file.md5 generate sqlite.file calculate md5 sum of sqlite.file and output it in sqlite.file.md5
and the client should do:
download sqlite.file.md5 if not found: wait some time and try again (in progress) download sqlite.file calculate md5 of sqlite.file and compare it with sqlite.file.md5 if there is a mismatch you probably downloaded in the middle of generation
actually you do not know how much time you need to delay your download, your php script does not know also (for example: depending on the os's scheduler it might starve a bit and every generation can complete in different time interval) you can only know when the generation is complete
EDIT: or you can just insert one record in the end of the sqlite file after generation is complete and then check if it exists in the downloaded file