iOS local file access and webkit - ios

I'm absolutely new to iOS App development (I haven't actually started yet, still in a design phase).
The task that I have to accomplish with my app is to download a zip from somewhere, extract anywere to local storage and display its content (html pages with javascript) in a embed webkit widget.
The questions are:
1) Will my app have access to any folder of my iPad storage memory?
2) Will my app's embedded Webkit widget be able to display local html pages (like file:///somewhere/over/the/rainbow.html ?
3) WIll that local page be able to use Ajax method (over httpxmlrequest) to dynamically load external scripts or xml (also locally stored - ie ./something.xml)?
Thank in advance for any help!

No it can't access any file. Apps are sandboxed on iOS. You can only access the app bundle's content and documents folder (a writable area unique to your app).
Yes - provided said content is in the areas mentioned in (1). This is how Phonegap-based apps work.
Yes - they can. We've done exactly this extensively in several of our apps.

Related

iOS Share PDF from Adobe Reader

I'm newer to iOS development and I find the file system to be difficult to work with. I've got many cases implemented in my app to share pdfs from browsers and the files app, but when i try to share a pdf from adobe the shared url to the resource looks like:
file:///private/var/mobile/Containers/Data/Application/EB6B8570-6422-49D8-BCBD-C68B9CBCF3C9/tmp/BBTempFileManager/sharedcopies/C2FB25ED-1414-49F0-8953-FFF3A4F6C76C/Sky.pdf
I have a shared container set up that I can already successfully read and write to during other scenarios. Any ideas why the system believes the file does not exist in this location? It appears maybe I just don't have access? What entitlements/permissions should be set up to explicitly allow for this?

Cordova iOS - WkWebView offline

Application cache is deprecated which means we'll need to switch to service worker but I've done research it was mentioned..
1) "It is not possible to use a ServiceWorker in a Cordova app because the ServiceWorker API is not available to WKWebView and is not implemented in UIWebView. It is available in Safari on iOS, but not WKWebView."
//https://github.com/apache/cordova-ios/issues/414
2) Enabling appcache using private api is not working
//Enable Application cache in WKWebView
3) Cordova file & file-transfer plugin is not even recommended to use for production.
Is there any alternatives to be able to store artifacts (html, js & css files) and load for offline used? Our application needed to cached 300-400 files.
Appreciate your suggestions in advance! (:
Well to answer your question, my suggestion would be this: Get rid of those 400 files and find a more practical way to replace them.
Exactly why would you need to store so much CSS files in a Cordova app anyway? There's no logical reason that I can think of. Nor practical, loading other HTML files in the WebView goes against the SPA design principle.

WKWebView File System Browser

I've been asked to add a file browser to an existing Objective C application that uses a WKWebView to load up a Javascript internal app.
Currently we have the capability of looking at the pictures on device to upload images into the app, but I've now been asked to do the same with more generic file types, specifically PDFs.
What I've read so far is that this is only possible if a file is stored in a specific part of the file system and only if the app knows exactly where the file is to begin with, but what I need is the capability to browse to a certain degree.
What I'd like to know is whether this is possible and if there is a good place to start on that?
Thanks.

How to upload HTML File(contains img,css and js) to Contentful (CMS)?

I have created a sample HTML(contains js, css and images) guide. I want to upload this html file to CMS(content management System) to edit content later. After that I will retrieve html content from CMS System and load it in my iOS app. So my guide will not be static and I don't have to rebuild for my iOS app every time. I reviewed content-ful api service, but can't find a way to upload html file. is this possible ? Please help me on this? or any other ideas?
I think it's not unfortunately possible. In your case it's easier to add content manually to your Contentul space and then retrieve the content within web application using JavaScript SDK. If you're going to create iOS app as well, then Objective-C SDK and Swift SDK might be useful for utilizing the content in future.

Want to open a dialog box to open file in web browser based application

Am using JSF and primefaces to develop web application.I want to open existing files on client machines using dialog box which prompts the user to select a path and the corresponding file. Please suggest a component which can be used.
While I doubt the feasibility of your intentions; accessing content directly on a client's machine (some security implications there), a combination of <p:media/> and <p:lightBox/> will work for you. There are file type restrictions imposed by primefaces though (multimedia files and pdf only) The <p:media/> can be embedded in the <p:lightBox/> like so :
<p:lightBox>
<p:media value="{yourBean.filePath}" width="100%" height="300px">
</p:lightBox>
Like I said, I doubt the feasibility of directly streaming content from a client's local filesystem. How do you intend to use the path c:\Users\john doe\my documents\my books\book.pdf on a user's local system within your own web application, without first uploading the file to your own webserver? With image files, you might have some success loading the file into memory and streaming the file directly from RAM using <p:dynaImage/>...consider the scalability of this option too for a high traffic application

Resources