asynchronous download and save with progress problem on iOS

Monte Goulding monte at sweattechnologies.com
Tue Jul 24 22:47:45 EDT 2012


From the release notes:

To download a url in the background, you can use:
load url tMyUrl with message "myUrlDownloadFinished"
Note that, the callback message received after a load url will be of the form:
myUrlDownloadFinished url, status, data

On 25/07/2012, at 12:16 PM, Terry Judd wrote:

> Here's the problem - I'm downloading a document (pdf) and displaying a progress bar as I go. When the download is done I then display the document in a viewer. I'm using Monte's mergDoc external for this but I could just as easily be loading it into a browser object.
> 
> If I use the synchronous approach - put url pURL into url ("binfile:"&pPath) - then it works fine. My progress bar is updated in a urlProgress handler and when it completes I trap the 'downloaded' message in this handler to display the file.
> 
> Now, what I really want to do is to use the load command so that the download isn't blocking. However, if I do this then I get caught up in an endless loop.
> 
> If I use a custom message with the load command, like this...
> 
> load url pURL with message "pdfdownloaded"
> 
> and then in the pdfdownloaded handler do this...
> 
> put url pURL into url ("binfile:"&pPath)
> 
> Then this kicks off another download and the progress bar goes through its routine again. At the end of this second go the document displays as expected.
> 
> If however I don't use a custom message and I trap the 'downloaded' message in the urlProgress handler and try to put the loaded url into the destination file then it kicks off another download, and then at the end of that another - forever.
> 
> What am I doing wrong - or is this a Livecode problem?
> Has anyone successfully implemented something along these lines that uses load url rather than put url?
> 
> Regards,
> 
> Terry...
> 
> 
> Dr Terry Judd
> Senior Lecturer in Medical Education
> Medical Eduction Unit
> Faculty of Medicine, Dentistry & Health Sciences
> The University of Melbourne
> 
> 
> 
> 
> 
> _______________________________________________
> use-livecode mailing list
> use-livecode at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode

--
M E R Goulding 
Software development services
Bespoke application development for vertical markets

mergExt - There's an external for that!




More information about the use-livecode mailing list