Page 1 of 1
open remote file in iOS
Posted: Tue Feb 22, 2011 3:04 am
by witeowl
I'm a working on a vocabulary game for my students. I have it set right now that vocabulary lists are stored as the CSV contents of fields on a "secret" card. The player selects a list from a menu button, that list's field is "loaded" into the game, and play commences. OK, it works, but as my curriculum changes, it would be much easier to change the vocabulary files on a webpage rather than having to update the app; moreover, I could develop other games which call the same CSV lists.
So, the question is: in an iOS app, is it possible for the player to select from a list of files stored on a webpage and load a CSV file from the webpage?
1) Is it possible?
2) If so, any hints on execution?
Thanks!
Re: open remote file in iOS
Posted: Tue Feb 22, 2011 4:22 am
by FourthWorld
It's technically easy to do in LiveCode:
go url "
http://www.domain.com/folder/mystack.rev"
You can even shorten download time by using LC's built-in compression.
But that said, I believe the iOS developer agreement prohibits downloading code modules from iOS apps. Not sure how that plays out in your specific scenario, but you may want to review Apple's guidelines before architecting for this.
Re: open remote file in iOS
Posted: Tue Feb 22, 2011 8:19 am
by witeowl
Thanks for the reply, but I think you misunderstood. I don't want to show a webpage, nor do I want to download an actual code module. I basically want to read (only) information in a text file stored elsewhere. (A comma-separated-value text file.)
I know that other iOS apps access files stored online all the time, and the information stored within them, I just don't know if it's possible through LiveCode.
Basically, I guess I'm asking if I'll be able to do something like this:
Code: Select all
on mouseUp
set the defaultFolder to specialFolderPath("Documents")
put URL ("file:iphonetest.txt") into field "read"
end mouseUp
but with the txt file residing somewhere online instead of on the iPod.
Hmmm... As I write this, it really seems like a, "Well of course you can!" question; I guess just want to make sure before I begin pulling my hair out.
Thanks again.
Re: open remote file in iOS
Posted: Tue Feb 22, 2011 12:55 pm
by Klaus
Hi whiteowl,
do this:
Code: Select all
on mouseUp
put URL ("http://www.yordomain.com/folder1/folder1/your_text_file.txt") into field "read"
## When no error occurs, THE RESULT is empty,
## otherwise contains a string describing the problem
if the result <> empty then
answer "There was an error loading the document!" & CR & the result
end if
end mouseUp
Best
Klaus
Re: open remote file in iOS
Posted: Wed Feb 23, 2011 7:51 am
by witeowl
Thanks, Klaus. That looks like a good way to test before writing too much code.

Re: open remote file in iOS
Posted: Sat Feb 26, 2011 8:09 pm
by witeowl
Hmmm... Well, this is weird.
I created a "test" button using the code given by Klaus, edited for the file and field. It works without error in LC, but does absolutely nothing in the simulator. No error, no text in the field, no nothing. Just... nothing.
I can use Safari in the simulator, type the address of the file into the address bar, and Safari loads the list, in case that matters. It's just the LC standalone that doesn't seem to...
Ideas? Thoughts? Alternate solutions?