Unexpected behavior in iOS app

J. Landman Gay jacque at hyperactivesw.com
Wed May 11 18:05:06 EDT 2011


On 5/11/11 1:17 AM, Terry Vogelaar wrote:
> I'm running into a few problems building an iOS app.
>
> The most important one is this one. I want it to retrieve data from an 18MB text file, because I want it to work when the device is not connected to the internet. So I tried this:
> on preopenstack
>     put "file:"&  specialFolderPath("documents")&  "/Muziek.txt" into docsmap
>     if the environment = "mobile" then
>     answer "Download or use local?" with "Download" or "Local"
>     if it is "Download" then
>        put url "http://dl.dropbox.com/u/10128030/Muziek.txt" into muzieklijst -- not the actual url
>        put muzieklijst into url docsmap
>     else
>        put url docsmap into muzieklijst
>     end if
>     else
>       put url "file:~/Dropbox/Public/Muziek.txt" into muzieklijst
>    end if
>    -- and some additional processing of the muzieklijst data that works fine
> end preopenstack
>
> As you can see, it intends to write the text file I expected the
> download to be only the first time the app is used, or optionally
> when I know the file has changed. It takes a few minutes staring at a
> black screen, but eventually it works.
>
> But apparently it doesn't save the file on the iPod Touch. The
> variable muzieklijst only contains data when it is freshly
> downloaded. If I tap on the "Local" button, muzieklijst stays empty.

Check to see if the path is really valid in iOS while the app is 
running. Add this to your script temporarily:

put "file:"&  specialFolderPath("documents")&  "/Muziek.txt" into docsmap
answer "File exists:" && there is a file docsmap & cr & docsmap

See what it says. SpecialFolderPath should work, so I suspect the path 
isn't resolving correctly.

> I see a beautiful picker on iOS when using a
> button with the menuMode set to 'option'. But on screen, the button
> looks 90'ish with an ugly border around it.

I haven't played much with these yet, so can't say. Maybe someone else 
knows.

>
> Also, I applied a great technique I learned on the Beginners Mobile
> Course on the Simulcast. I put a bunch of PNGs in a Resouces substack
> and I copied the scripts from the Ticked Off stack, used in the demo.
> It worked great; it scaled all the icons  on the main stack. But as
> soon as I switched an icon (using: "set the icon of me to 1023"), it
> showed (the center portion of) the large version of that icon; not
> the downscaled one I wanted to see.

All the images in your resources stack need to have their lockloc set to 
true so they won't revert to their original dimensions. You only have to 
do that once, when you set up the images.

-- 
Jacqueline Landman Gay         |     jacque at hyperactivesw.com
HyperActive Software           |     http://www.hyperactivesw.com




More information about the use-livecode mailing list