Hi, I need to get an array (potentially a UITableView) of items in a url (Directory) So if http://www.example.com/files was the url, i need an array of all the items in that directory.
I looked at NSArray's arrayWithContentsOfURL: method, but I'm really stumped by this one.
You'll have to get the contents of the URL into a string and then parse the string for filenames. Don't use the xxxWithContentsOfURL functions unless you're just messing around - they completely lock up your app while they are running.
You'll have to get the contents of the URL into a string and then parse the string for filenames. Don't use the xxxWithContentsOfURL functions unless you're just messing around - they completely lock up your app while they are running.
Well I could put it on another thread...
But it matters not-
I need to retrieve a directories contents.. It's not HTML, it's a directory so I need to enumerate that.
You'll have to get the contents of the URL into a string and then parse the string for filenames. Don't use the xxxWithContentsOfURL functions unless you're just messing around - they completely lock up your app while they are running.
I think you have the answer, do you have any idea how you might go about putting the contents of the URL into strings and parsing the results?
Well you need a directory listing of some sort... either web server created or otherwise. Unless you have that I can't think of any way to do it. (not to say there isn't a way to do it :P )
I'd get the HTML of the listing and then just find the <a href=""> tags, yup. (Given the assumption that you can't get cleanly delimited/structured data)
I need to retrieve a directories contents.. It's not HTML, it's a directory so I need to enumerate that.
Does anybody know how to do that?
Thanks so much
Steake.
I would use a server-side script that turns the directory listings into a JSON string and prints that. Then you just grab the URL in your iphone app and decode the json. Voila, you've got an array of filenames. (Or whatever other kind of data structures you need.)