Hello, I need some input on possible ways I can solve a huge issue in one of my current apps.
Basically, my app on the app store ships with about ~700MB of PDFs stored in the mainbundle. I've had a few people get annoyed with having to redownload the app update only when I update a state or two's regulations. I agree with them, it is annoying, and I therefore want to put a significant update into my app that will allow me to basically never have to submit an app update again.
Here's what I want to do: 1.) Move all mainbundle "shipped" PDFs into a Documents folder which will tie in with point #2.) Connect to a website's folder and view the PDFs I put in there as updates. 3.) Before displaying the updates, check the modified date of the PDF files on the server against the "shipped" PDFs, then display only the ones that need updated each in a table cell and alloc an Update All button; if no new PDFs are found, display a UIAlert "No updates found" 4.) If there are updates, and the user clicks the Update All button, then begin download (with a progress indicator) and overwrite the "shipped" PDFs with the newer ones.
Sorry for the long post, I'm sure all of this is doable, I just need some help/input on where to get started.
Hello, I need some input on possible ways I can solve a huge issue in one of my current apps.
Basically, my app on the app store ships with about ~700MB of PDFs stored in the mainbundle. I've had a few people get annoyed with having to redownload the app update only when I update a state or two's regulations. I agree with them, it is annoying, and I therefore want to put a significant update into my app that will allow me to basically never have to submit an app update again.
Here's what I want to do: 1.) Move all mainbundle "shipped" PDFs into a Documents folder which will tie in with point #2.) Connect to a website's folder and view the PDFs I put in there as updates. 3.) Before displaying the updates, check the modified date of the PDF files on the server against the "shipped" PDFs, then display only the ones that need updated each in a table cell and alloc an Update All button; if no new PDFs are found, display a UIAlert "No updates found" 4.) If there are updates, and the user clicks the Update All button, then begin download (with a progress indicator) and overwrite the "shipped" PDFs with the newer ones.
Sorry for the long post, I'm sure all of this is doable, I just need some help/input on where to get started.
Thank you in advance
On the server side, you'll need a bit of code that checks the modified dates of the relevant files. I did something like that a couple of years back using PHP, and it was pretty straightforward. I parse the modified dates into plist format so it is really easy to retrieve the data from the iOS device. After that it should be pretty easy to go forward, just download the modified files to the device and
store them in the Documents folder.
Here is the PHP code I whipped up, though for my purposes it only checks if any of the files have been modified and returns the last modified date. But you should be able to modify the code to suit your purposes. Also, I had zero knowledge of PHP so I don't know how good my solution is, but it has worked well so far.
That works for me since I have just one date I'm interested in. For you, the NSDictionary should contain the filename and last modified date for each file, but that shouldn't be too hard to implement.
On the server side, you'll need a bit of code that checks the modified dates of the relevant files. I did something like that a couple of years back using PHP, and it was pretty straightforward. I parse the modified dates into plist format so it is really easy to retrieve the data from the iOS device. After that it should be pretty easy to go forward, just download the modified files to the device and
store them in the Documents folder.
Here is the PHP code I whipped up, though for my purposes it only checks if any of the files have been modified and returns the last modified date. But you should be able to modify the code to suit your purposes. Also, I had zero knowledge of PHP so I don't know how good my solution is, but it has worked well so far.
That works for me since I have just one date I'm interested in. For you, the NSDictionary should contain the filename and last modified date for each file, but that shouldn't be too hard to implement.
Thank you for posting. I have a couple of questions, in the php code it looks like you have to type out each file name, is there a way it can determine itself to see how many files are in the folder so I don't have to modify the php everytime I add a new PDF to the server?
Also, how can I go about migrating my current mainbundle PDFs into a documents directory?
Thank you for posting. I have a couple of questions, in the php code it looks like you have to type out each file name, is there a way it can determine itself to see how many files are in the folder so I don't have to modify the php everytime I add a new PDF to the server?
Also, how can I go about migrating my current mainbundle PDFs into a documents directory?
Thanks in advance!
Yeah, in my case I have just three files that I need to check, but you could do it in a dynamic way, though I don't know how. I'm not really versed at PHP, I created my code with a bit of Googling so I suppose it wouldn't be too hard to modify it to list the contents of a directory and work with that instead of hardcoded filenames.
As for the migration, since the main bundle is off limits, you have to remove the PDFs from the bundle in an update to the app, and then download the PDFs to the documents directory. That is, I believe, the simplest and easiest approach.