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
Related
I need a tool to programmatically convert epub files to a series of images. The output should look like screenshots taken on a canonical device (for this application, an iPad). I haven't been able to find any tools that do something like this.
So what I'd really like (1) is a tool that does that. But assuming that I'm correct that no such tool exists, is there (2) a library (preferably a Perl module, but I'm not that picky) that will read and render ePub?
Obviously, rolling my own I could combine tools for unzipping, reading html, reading xml, putting everything in the right order, and rendering html within certain constraints. Though I'd rather not do that, and if that's the only option I'll have to go on to look for a tool that will do the last part of that or I'll have to create that too.
Any leads on (1), or failing that (2)?
Apologies if what I'm about to type is just crazy-talk on my part--in fact, I'm pretty sure it is--but perhaps something like this might work and I'm kind of interested in knowing how well it might work for you:
Use Frank (https://github.com/moredip/Frank) to control the iOS Simulator on a Mac. Program it to open up the EPUB docs you need.
All you need then is something to automate the taking of the screen shots. Obviously, these will look like the EPUBs are being rendered in an iPad (or an iPhone if you wish--the iOS Simulator does both, of course).
Automating the screenshots can probably be done with AppleScript, although the hard part might be getting it to talk to Frank. Worst case, you can tell Frank to pause for 5 seconds after it loads each page and tell AppleScript to take a screen shot every five seconds. That sucks, but if you're desperate, it will get it done. It's also possible Frank can somehow make the screenshots happen--I haven't used it enough to know.
Pandoc can convert from EPub to LaTeX (and therefore to PDF) or to any number of other formats. Conceptually this should be a type (1) solution.
depends on your definition of "look like" - do you want the user-chrome or just the epub rendering for a given screen size.
I would check out the various epub readers for your platform of choice, size the window to your preferred dimensions, and then just "print" the epub to a virtual printer that outputs to image files - on windoze I use imageprint.
You could easily make a "frame" from an iPad product shot and place your screenshots within that - only thing missing would be as I said the user chrome.
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.
I need a file selector in an iPhone application I am developing to select a file to encrypt? Any idea how I would go about accessing files on the iPhone?
It would be something like this: http://iphone.heinelt.eu/?Applications:iFile:File_Browser
If you’re making a file browser, you’re probably taking the wrong approach. The design philosophy of iOS—and the Human Interface Guidelines—strongly recommend that you not expose the filesystem unless you really, really have to. Generally, collections of documents in iOS apps are displayed as a flat list—witness the built-in Notes app as well as Apple’s own iWork (Pages / Keynote / Numbers) suite. You can display that list in a UITableView, which you can find plenty of documentation about and tutorials for by Googling it.
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.
I want to bind my app to some file extension so when I receive an email with an attached file with the correct extension, clicking on it will launch my app and pass it the attached file.
Is it possible ? How ?
Thx
--G.
As iPhone applications are not allowed to share files on the file system, what you're looking for is not immediately possible (not with the published APIs that I know of, anyway). You might still have a couple of options though.
Either way you'll have to use a custom URL scheme, which is associated with your app, and paste that into your email. This URL might point to some external location, which your app can download the file from.
Or it might contain the actual file contents if it's fairly small. URLs are 'just text' (some restrictions apply), so you're free to put any data you want to in it, as long as it is URL-encoded.
You still need to get the URL into the email though, which might or might not be as easy as attaching a file.
It's not possible to simply associate a file extension with an application on the iPhone.
You could create a custom URL scheme that would launch your app, but probably that won't help you.
This is actually possible, I'm working on this exact same problem and this great tutorial has really helped me.