Search code examples
iosobjective-cibooks

iBooks app crashes when opened with IBAction in my app


All right, I am having a problem opening the iBooks app using an IBAction in my app. I have it set up so that when the user presses a button, it calls this action to open the iBooks app:

-(IBAction)openBooks:(id)sender
{
    NSString *stringURL = "iBooks://";
    NSURL *url = [NSURL URLWithString:stringURL];
    [[UIApllication sharedApplication] openURL:url];
}

This does the whole app switching this and looks great. I see the bookshelf where all of my books should be, but then the iBooks app crashes before my books load! The app I wrote doesn't crash, but iBooks fails!

I am running my app via XCode (the app isn't actually distributed to my iPad, per se), is that why iBooks crashes? When I touch the iBooks icon to open it (not via my app) it opens fine and works. But if I change the url in my IBAction like this:

NSString *stringURL = "maps://";

and run my app, my button works and Maps opens up!

Is this an iBook bug? Or is it my bug?

FWIW, I'm using iOS 6 and XCode 4.6.3


Solution

  • OK, so my bad. I found that I was using the wrong URL scheme. The iBooks:// I got from wiki.akosma does NOT work, but itms-books: DOES work.