views:

469

answers:

2

Using iPhone SDK: 3.0 (Firmware 3.1.2)

I'm new to iPhone development and researched here and google for a few hours with no luck. Here's the issue:

I have an ebook in epub format that I want to sell on the app store, but the app store requirement is that the epub must be contained in an iphone app. So, I decided to make an app that installs my ebook into Stanza or any other number of iPhone ebook readers.

So, the first method I used was using NSURL (with stanza protocol) pointed to an epub that's hosted on a website, e.g. (stanza://www.myebooks.gov/mybook.epub). This worked just fine and loaded the epub into stanza. However...

To minimize the risk of having my book so easily pirated, I'd like to include the epub as a resource in my application and pass that resource to Stanza or any other ebook reader that's compatible via a local URL pointed at the filesystem (e.g. stanza://var/mobile/Applications/GUID/*.app/ebook.epub) or by some other method.

I've tried loading a UIWebView, telling it to load a local resource (e.g. stalking.html) and inside the html file having the *.epub linked as , but that wasn't working either. I've tried with "../" without it and multiple variations to see if anything worked.

I've also tried: NSString *resourcePath = [[NSBundle mainBundle] pathForResource:@"ebookTitle" ofType:@"epub"]; resourcePath = [NSString stringWithFormat:@"stanza://%@", resourcePath]; NSURL *resourceUrl = [NSURL URLWitHString:resourcePath];

[webView loadHTMLString:resourcePath baseURL:resourceUrl];

It opens stanza, but stanza shows the path as just "var/mobile/Applications/..." instead of "/var/mobile/Applications/..." I didn't know if that was the only issue or if the whole thing fails based on permissions/security/etc.

It seems like this would be possible somehow, but I have my doubts because of sandboxing and other security features I'm unaware of.

Thanks, anyone that can help. :)

A: 

As far as I know your app has no access to other apps' sandboxes, which means you have to make your book app self-contained.

Costique
Thanks for your help. :)
codebx
+1  A: 

You cannot access the resources of another iPhone application. This is the security sandboxing of the iPhone OS.

Mike Weller
Thank you. I appreciate your help.
codebx