Epub source code issue during extraction - epub

I'm trying to 'see' the source code for an interactive ebook (.epub) that I have on my ipad and it is running fine on Ibooks app.
What I did is changing the ebook's file extention .epub to .zip and unzipping it.
The problem is that whenever i try to open the files inside the epub folder they are completely messed up:
where is the problem?
(The book I tested with is on itunes store "the wind and the sun")

The book is encrypted using Apple's FairPlay DRM.

Related

Where is the file saved by Cordova File plugin on iOS

I am writing a PDF file on an iPhone running iOS 11, using Cordova File Plugin (in Ionic). The file is created successfully (e.g. in a location like file:///var/mobile/Containers/Data/Application/CDFC4E19-082F-4878-9168-F4A735CDAFEB/Documents or file:///var/mobile/Containers/Data/Application/DA918690-B345-438A-B26D-2EA21D618341/Library/Cloud), but then I can't find the file on the iPhone. I have tried setting the directory to cordova.file.documentsDirectory as well as cordova.file.syncedDataDirectory. When I run the Files app on the iPhone, it shows no recent documents, nor any documents at all. I can't find the file on the phone to view it outside of my app.
Where do I have to save the file to make it findable outside of the app?
I think I've answered this myself. Viewing a PDF that an app created is just not a thing on iOS, as useful as that may be. You can of course do that on Android, which is far more useful. It appears that to view the PDF, you have to use iTunes on an iMac to download the file from the phone. Jumping through those Apple hoops, which I am slowly becoming accustomed to, I was able to view the file in the cordova.file.documentsDirectory location.

Uploaded verified local fXL epubs don't open in Google play books

My fixed layout epub is verified with epubcheck-4.0.1: no errors, no warnings. On ibooks and Readium: no problems at all.
I upload the file to my google play books library on Chrome, Firefox, safari. The epub doesn't open and gets stuck with "Processing..." keeping displayed.
Now, I 'buy" a free fixed epub from the google play books store. The epub opens. I downloaded the epub. Upload it again. Now it doesn't open any more. Message: "This book cannot be opened
This book contains content that is not yet supported in your browser."
I try the same procedure on an Android device. Same behavior.
I am stuck and would be grateful to have a few hints to move from this gridlock.
This is not possible to read a local epub on the playbook reader within a browser. The native play books reader must be installed instead.

Can a PDF downloaded by my iOS app be viewed by iBooks or any other application?

Right now, the PDFs I download on my app are being stored in the app's document directory and can be retrieved only within the app. Is there any way to store the PDF files in the common documents directory that can be accessed by other apps?
If not, is there a way of storing my downloaded PDFs in other apps' documents directory (let's say iBooks), so that it will always be stored in iBooks.
If there are any ways, please elaborate.
There is no "commun documents directory" on iOS, each App is launched in is own sandbox and cannot access the files from other app directly.
I suggest you to check the iOS File System Basics guide from Apple in order to understand better what's happening behind the scenes.
You can still use an UIActivityController in your code to perform an export of your pdf file to iBooks or any app accepting this kind of file, but it requires some user interaction.

Writing to a file in my iOS app

I have an app that downloads files that need to be edited and submitted back to the server through the app. These files could be anything, but are most likely to be .docs. I want to be able to open and edit these files in another app on the device, such as a .doc editor.
I've been able to get this functionality to work in similar Android and Chrome apps, but I'm very new to iOS so I'm not sure what my options are.
Is there a way to give permission for another app to edit a file that is in my app's sandbox? If not, is there a way to get the file back for submittal (like finding it through a file explorer launched through my app - similar to an 'Open..." file explorer dialog used in Windows/Mac OS/Chrome)? Am I going to have to create a way for the editor app to share the edited file back to my app?
Thanks in advance for your help!
To manage the file and the paths take a look at the documentation for NSFileManager:
https://developer.apple.com/LIBRARY/mac/documentation/Cocoa/Reference/Foundation/Classes/NSFileManager_Class/Reference/Reference.html
I usually write using NSFileHandle for reading and writing:
https://developer.apple.com/library/mac/documentation/Cocoa/Reference/Foundation/Classes/NSFileHandle_Class/Reference/Reference.html
Hope this helps.
iOS8 will provide methods to allow apps to co-operate with "extensions".
See "Creating Extensions for iOS and OS X, Part 1 & 2` in the WWDC14 videos.
Also see the Apple "App Extension Programming Guide".
I ended up sending the file to a 3rd party app for editing and then sending the file back from the 3rd app to my app.

Copy file to/from NSDocumentDirectory during dev

I'm playing with NSDocumentDirectory and saving files on my iPhone. I have created a dictionary and saved it successfully to NSDocumentDirectory and I can re-load it upon re-launch of my app. However, during development I would like to actually browse and copy files to and from NSDocumentDirectory. Is there a way via X-Code or Finder or iTunes to see the contents of my app's NSDocumentDirectory?
The real goal here to move a file generated on my iPhone to my iPad, but starting with copying back and forth from Mac to device would be great!
Any advice is much appreciated.
You can transfer files to / from app's Document directory through the File sharing feature in iTunes. To do so, you have to set UIFileSharingEnabled property to YES in your app-info.plist. See this question if you have problems setting it up.
Download iFunBox. It will allow you to access the IOS file system.
The latest version is here.
IPhoneExplorer is available for Mac and Windows.

Resources