Retrieving updated files from server to replace files on documents folder of an iPhone - iphone

Im new to iPhone programming and wanted to see how people have solved this problem:
Ive created my app which will ship with certain pLists and .png files in the main bundle. However, what I want to do is when the app starts up, Id like it to check my server to see if there are updated versions of the files in the documents folder available. If so Id like the app to download those files.
I was wondering if someone can point me to some resources on how to do this? Ive searched online but haven't come up with good hits.
Whats the google key-word for searching this topic anyways?
Thanks a lot

you can use NSUrlRequest to download the files, to move them to the correct place you can use NSFileManager, if you look at the apple docs for both these classes there should be sample code explaining how to copy/save a file from NSData, and also how to download it.

I don't have any example resources of how to do exactly this, though I would probably do something along the lines of onAppLoad checking to see if the content of the application that you want to keep updated is the most recent, and if not, download it.
As for keywords to search I would try something along the lines of "Automatic App Content Updating/Verification" and throw in "iOS/iPhone/iPad" or some similar combination.
I'll do some more poking around and shoot you a comment notification if I find anything worthwhile, and then edit my post with it.

Related

How do I open a file in my IOS SwiftUI App?

I have an app that saves data in my Documents directory. It would be very useful to be able to mail the data file to some other users so they can also use the gathered information. I have spent most of today looking for a solution, but have not found any answers basic enough to be of any help. So, I would greatly appreciate some help to get me started. Like, what do I need to do to make IOS aware that I am interested in opening ( in my case actually only copying the file to the app’s Documents directory for further chewing) a file with, for example the .xyz-extension and how this is done.
Much appreciated,
stalle
Running on a real device, there seems to be no problem.

HTTP file upload taking component for iOS

I noticed the functionality on some PDF viewer for iOS. You can actually turn phone in server and upload files there from a normal computer. I found HTTP server implementation from iOS on Google site, so implementing upload accepting functionality isn't a big deal for me. However I would like to save couple hours of my time, so if somebody could point me to ready to use solutions in sources, I will own you a bottle of your favorite beer.
It looks like I will have an extra beer this weekend. No I didn't create one, but i found one
enter link description here
Actually I found bunch of them, but this one seems has upload handling code which was my goal. If somebody found a better server solution, then do not hesitate to share with me.

Adding PDF to iBooks by code

I was recently asked if I could code a simple IPhone/IPad app that:
Checks an FTP server for changes to a PDF file (easy)
Downloads the lastest PDF (easy)
Adds or replace the file on iBooks (hmm...)
I have tried to find any code that deals with inserting/adding/updating files inside iBooks, but sadly there is very little on the subject. Is this even possible except manually through iTunes? My gut feeling says that it's just a matter of writing the file to a folder..
It makes sense if it were such an API. There are many companies that would like to keep their product portfolios up to date, or research manuals that (in theory at least) could benefit greatly from being updated automatically through an app.
Any help or comments are welcome.
My gut feeling says that it's just a
matter of writing the file to a
folder..
Unfortunately, this probably isn't the case. I'd imagine iBooks using some sort of database to keep track of books, rather than simple files.
There is a URL schema for iBooks, but it's undocumented, and nobody has found any methods that would update/replace a book (I don't know if any even exist): How do I launch iBooks e-reader programmatically on iPad?
If you feel this is something that would be beneficial to iBooks, you should consider filing a feature request on the Apple dev site.
UIDocumentInteractionController is your friend in this case

How to use Offline Cloudmade Maps in an iPhone App

I’ve looked through the posts on the Cloudmade site here and I get some of it, but not all. I've posted the question below, but haven't had the help I need, so I thought I'd ask the question here.
I can see that I need to:
download the tiles for the required area to my Mac (but can’t see how to do this)
convert these to a sqlite database using the map2sqlite utility, changing the code to output the tiles to a table called “ZCACHE”, not “tiles”
Copy the DB to the Application Bundle
insert some code to copy this DB on first run, from the Application Bundle to the Documents Directory
Somehow get App to use this DB and not an online one – I can’t see how that’s done.
Any help would be warmly welcomed,
Chris.
The best solution for me to have iPhone offline maps is:
1.- Generate your own maps with TileMill and then export to MBTiles format.
2.- Get the mbtiles-ios-example and use the MBTiles file you just generated. In order to compile it, you need to download Route-Me and add it to the project.
Now, there is another option (not for free): Mapbox.
please check this tutorial, it can help - http://www.gisnotes.com/wordpress/category/sqlite3/.

iPhone Simulating App Update at home before going out in the big bad world

this is a follow on from this question and the link given it seems that when an app is updated all of the files in the documents directory are copied into the updated apps documents directory and also anything in Library/Preferences. Whats the best way to simulate this for testing purposes?
Just copy the files in ApplicationSupport/iPhone Simulator etc? or has anyone developped any funky techniques for testing this.
I have created .sqlite file in my application's documents folder and created some dummy entries in my database table.
Now just change you code build new application without changing any of the certificate and profile information load the new application.
Now check for the old database table records. It will be definitely preserve under your Document directory in .sqlite file.
This is what i followed when i want to check it for same thing.
If anyone know better way then please feel free to suggest new things.
Jim.