UIWebView - Read content from file and delete the file - ios

I have downloaded some content and store it in a file. While it was writing in the file, I will encrypt the file content. Now I have to show the decrypted file content in UIWebView. So , What I have done, I will decrypt the content and store it file.
Using loadRequest I can the content in UIWeView. Now again , I have to encrypt the content. How to do THIS? When will I come to know the loadRequest is finished without using UIWebView Delegate method (webviewDidFinishLoad)?
Is there and guidance on how this cane be done? Is even it possible to do it? I would appreciate any suggestions or some other way to do this.

I think it does not have the direct way to solve this issue. So, I have manually removed the file from the document directory after some time using the afterDelay method.

Related

How to write text into the file saved on server in swift3 iOS

I am trying to write some text to the file on Server. Text file server path is:
http://test.info.com/log.txt
So, whatever we will write on this text file can able to see in browser. Please anyone suggest me.
In one word, There is no on the fly write possible from mobile to server file.
Justification:
Question:
What's happen if I paste the logfile URL(http://test.info.com/log.txt)
into the browser?
Answer:
It will just download the log.txt file. Also, It will not allow doing
direct editing in the browser too. If it will is not feasible from the browser So how can we do it from the mobile end?
Alternatives:
Recently I worked with the same type of requirements. I have achieved it by creating the local log.txt file. Write into this file. Every day, I have uploaded the same log file into the server.
To write into the log file, I have used SwiftLog(Simple and easy logging in Swift)
You need to create 2 APIs on the server where your text file is kept. One API to get the data of the text file. Once that is done, show it in a TextView and edit it.
After editing, you can call another api to send the updated data back to the server.

How to read pdf file in ios .I am not using UIWebView

I want to read a pdf file which is coming in URl from server. I am not using UIWebview.
So, i just want to know that is there any way to view that pdf file without downloading in to device. Just it be readable or buffered, not stored.
Any suggestions for that.
The easiest way to show a PDF outside of a UIWebView is using the QuickLook framework:
http://developer.apple.com/library/ios/#documentation/FileManagement/Conceptual/DocumentInteraction_TopicsForIOS/Articles/UsingtheQuickLookFramework.html
However, as isn't unreasonable, Quicklook requires URLs of a "file" type.
So without using a UIWebView, you'll need to add your own code to download/cache/display, which isn't hard. If you need sample code, let me know.

iOS - Download files to application folder

I do have a UIWebview inside one of my UIViewControllers. The destination URL to be displayed within the WebView is a page on my server (therefore I have access to make changes on it).
That page basically has a list of PDFs to be downloaded (imagine an un-ordered list of hyperlinks each pointing to a PDF file).
I need a way to tell my App that whenever a file is downloaded from that WebView by clicking on one of the links, I need it to be saved inside my application folder instead of the iPhone/iPad memory.
Is there any way I can achieve that? Are there alternatives?
You can allow UIWebView to call your Objective-C delegate function. This link provides an overview of how to do it: http://dblog.com.au/iphone-development/iphone-sdk-tip-firing-custom-events-when-a-link-is-clicked-in-a-uiwebview/ Basically, the delegate function will be called on all requests from the UIWebView. You can examine if they are for links to a pdf files, and if so, write your own objective-c code to download the file and store it in your Application directory. You'll probably want to add some UI to let the user know what is happening. Otherwise you let the request go on as normal and it will be displayed in the web browser.

UIWebView open url from file

I am making an app on iphone and I have got stucked at one point. I want to read a text file which has some list of URLs and then I need to read that file and open those URLs one by one in UIWebVIew. Can anyone suggest me how can I do that?? with some sample example.
Thanks in advance.
Check out NSDataDetector, you can find links by dataDetectorWithTypes:error: using NSTextCheckingTypeLink. More documentation: https://developer.apple.com/library/ios/DOCUMENTATION/AppKit/Reference/NSTextCheckingResult_Class/Reference/Reference.html

Downloading and saving files with AIR for iOs

For a project we need to download and save pdf files on an IPAD device for offline use through an AIR for iOs application.
After a lot of searching I haven't found much information on this subject. My question is, can it be done, and if so, can you provide us with some pointers to lead us in the right direction.
Thanks for your time!
Sure, first you check if you can access the web - can use a class like air.net.URLMonitor, if you can you can set up a URLStream instance.
You get data while its downloading the file using the progress event, write that out to a File instance using the FileStream class.
To display the PDF file you can use a StageWebView or HTMLLoader.

Resources