10

Just like UIApplication.openURL.

Is there an API to launch iBooks with an ISBN?

Bill the Lizard
  • 398,270
  • 210
  • 566
  • 880
Sujee Maniyam
  • 1,093
  • 1
  • 9
  • 15
  • Hi Sujee, Seems you have solved the problem. Do you know how to open a local file which I have already download to my App's application directory in iBook? URL to my file looks like this: file://localhost/var/mobile/Applications/51CC125E-5499-4E68-BF07-91DFFFC03B7D/Library/Application%20Support/82/index.pdf so I expect I can call iBook to open my PDF using URL: ibooks://localhost/var/mobile/Applications/51CC125E-5499-4E68-BF07-91DFFFC03B7D/Library/Application%20Support/82/index.pdf End up it open iBook app only, but not my pdf file. Anything's wrong in my URL?? – Bowie Feb 14 '13 at 04:21
  • @Bowie maybe it is to late, but you could try UIDocumentInteractionController – CarlJ Sep 11 '13 at 11:39

4 Answers4

17

iBooks registers the itms-books: and itms-bookss: URL schemes, so you can launch iBooks programmatically, but the actual URL might not be an ISBN.

kennytm
  • 510,854
  • 105
  • 1,084
  • 1,005
  • Thanks KennyTM. where can I find more documentation on this, specially the URL format ? – Sujee Maniyam Apr 07 '10 at 21:35
  • @linuxlover: If you have the iPad, try to open iBooks and copy a link in the iBookstore. If you see ISBN in the link, then it's good. Otherwise, we can only say the URL format is undocumented. – kennytm Apr 07 '10 at 22:30
  • 3
    Hi not sure about SO etiquette on an old question like this but is any further info available for this? Have launched url://itms-books on iPad and it opens iBooks to store. Cannot figure out url for specific book or PDF. Have also tried using md5sum as filename based on this link: http://www.gabrielgambetta.com/?p=40 – Mark May 30 '11 at 02:39
  • @KennyTM what if the pdfs are placed in my code lets say i do file = [documentsDir stringByAppendingPathComponent:@"myPdfPathiPhone"]; NSString *stringURL = @"itms-books://"; NSURL *url = [NSURL URLWithString:[stringURL stringByAppendingString:file]]; [[UIApplication sharedApplication] openURL:url]; will that work? and which scheme to prefer? – Muhammad Umar Jan 30 '13 at 20:56
  • hi kennytm, indeed it opens ibooks, thanks. But it doesn't download the file. Any solution? – Frade Mar 11 '15 at 17:55
9

iBooks

NSString *stringURL = @"itms-books:";
NSURL *url = [NSURL URLWithString:stringURL];
[[UIApplication sharedApplication] openURL:url];

NSString *stringURL = @"itms-bookss:";
NSURL *url = [NSURL URLWithString:stringURL];
[[UIApplication sharedApplication] openURL:url];
Michael Myers
  • 188,989
  • 46
  • 291
  • 292
6

For your info, folks: all it takes is to add the itunes.apple.com URL, the same you can find in iTunes when browsing the BookStore on the Mac, but replace http with itms-books and b00m, you have it! Example

itms-books://itunes.apple.com/de/book/marchen/id436945766

or

itms-books://itunes.apple.com/WebObjects/MZStore.woa/wa/viewMultiRoom?fcId=510054265&s=143443
StuFF mc
  • 4,137
  • 2
  • 33
  • 32
2

Guess the question is still looking for a perfect answer.

There is a book say Swift Programming in iBooks.

Is there a way to directly open this book, instead of first opening the iBook application then choosing required book.

NSString *stringURL = @"itms-books:";
NSURL *url = [NSURL URLWithString:stringURL];
[[UIApplication sharedApplication] openURL:url];

This piece of code opens the iBook from within the app, but what about opening a particular book.

Balaji
  • 21
  • 2