I am fairly new to coding for iOS, so forgive me if my question seems somewhat of a waste of time. Anyways, I want to upgrade my current app. In this update I want to have a grid layout of logos. These logos are really folders on a website. When clicking the logo it will bring you to another grid layout of images. The images will also be hosted on a website.
If I knew the urls for everything I could figure out how to do this. The problem is that every Sunday another folder is generated and there are about 1000 images posted within that folder. All of the file names are random and so is the folder.
I’m hoping someone can give me some guidance on how to code my app to look for any urls within the folder as I have no idea how I could do this.
Thank you for any and all advice. I really appreciate it!
This is a good question. You cannot search a folder on a website as you would on a computer. It won’t work. It is up to the server to provide you with a list of the contents of a folder.
Since the file names are random, you have to rely on the server to provide you with a list of the file names. Do you have access to the server? If so, you can write a simple PHP file that outputs a parsable list of the files.
Your app can then download this list, sort it, and download the files included in the list.
If you cannot put this PHP file on the server, then you are out of luck. The file names are random, so you have no way of figuring out what they are.
PHP
Change
"folder"to the name of the folder you would like to scan. If the PHP file is in the folder that you want to scan, change"folder"to".".Access this PHP file in your app the same way you are downloading the images. The output of the PHP file will be the response of the request. Whatever you’re using (
AFNetworking,ASIHTTPRequest,NSURLRequest) should allow you to get the response easily as aNSString. Use the following code to break apart the string into aNSArray.The array,
files, contains all of the file names in the directory that the PHP file searched.