I have a URL where I can download a PDF, but I cannot use something like:
[myWebView loadRequest:urlRequest];
since this link will send out some challenges…
However, I managed to get the PDF raw data NSURLConnection(to be exact, I can get the data in the delegate method:
(void)connection:(NSURLConnection *)theConnection didReceiveData:(NSData *)data).
And then I want to know, how I can show this PDF? Does anyone has any idea? Thanks a lot!
I have made my own, pdf download class, but this is the bits you’ll need. In the .h of the class. Declare:
Also subclass the delegates for the connection
Then in the implementation file, in
- viewDidLoad:The
connection:didReceiveData:method:The
connectionDidFinishLoading:method:So when it receives data, it builds up the _data, then when it finishes it writes it to the path. Make sure the connection delegate is set to
self.After that, you can open the path to the PDF as you did before.