More libURLDownloadToFile problems
Posted: Wed May 06, 2015 10:27 am
Two problems:
First:
The IDE keeps "losing" libURLDownloadToFile - I can sometimes do a minor change somewhere in my project and livecode will suddenly decide it cannot find that function.
At that point it also will not build the app (targeted to Android).
Sometimes, changing standalone app settings & changing back again works, but not always.
The same project works if opened in livecode 6. Usually, saving it and opening in 7 again then works...
Second:
I'm using the line
libURLDownloadToFile lqurl, lqpath, "dlDone"
to pull images from a server.
This works fine in the IDE and the callback is triggered on completion.
Initially I was just pulling files and assuming it worked if the file name appeared in the appropriate directory.
However, if an image file was corrupt or incomplete it corrupts the device screen when displayed.
I've changed to using an sqlite database to keep track of file requests, so I now give the files a temporary name to prevent them being used prematurely, then rename them when the download complete callback occurs.
That works perfectly in the IDE, but on the device it never gets any callbacks so the files are never renamed.
I've added a log field & I'm storing the result of every callback, whether successful or not.
Again, in the IDE I see the URLs and "downloaded" status - but nothing at all on the device, not one single result.
Something appears seriously broken and I'm at a loss as to how and work around it. The principle of the app is to fetch and display image data and with no way of knowing if a particular file has been downloaded successfully, it simply cannot function..
Any ideas appreciated!
RJ.
First:
The IDE keeps "losing" libURLDownloadToFile - I can sometimes do a minor change somewhere in my project and livecode will suddenly decide it cannot find that function.
At that point it also will not build the app (targeted to Android).
Sometimes, changing standalone app settings & changing back again works, but not always.
The same project works if opened in livecode 6. Usually, saving it and opening in 7 again then works...
Second:
I'm using the line
libURLDownloadToFile lqurl, lqpath, "dlDone"
to pull images from a server.
This works fine in the IDE and the callback is triggered on completion.
Initially I was just pulling files and assuming it worked if the file name appeared in the appropriate directory.
However, if an image file was corrupt or incomplete it corrupts the device screen when displayed.
I've changed to using an sqlite database to keep track of file requests, so I now give the files a temporary name to prevent them being used prematurely, then rename them when the download complete callback occurs.
That works perfectly in the IDE, but on the device it never gets any callbacks so the files are never renamed.
I've added a log field & I'm storing the result of every callback, whether successful or not.
Again, in the IDE I see the URLs and "downloaded" status - but nothing at all on the device, not one single result.
Something appears seriously broken and I'm at a loss as to how and work around it. The principle of the app is to fetch and display image data and with no way of knowing if a particular file has been downloaded successfully, it simply cannot function..
Any ideas appreciated!
RJ.