I have a UIWebview that loads a PDF with NSURLRequest. It will load the PDF, but if the pdf is too large the app crashes. I don’t receive a memory warning. Is there a way to get the size of the PDF before I download it?
Here is how I am loading it:
NSURLRequest *currentRequest = [NSURLRequest requestWithURL:[NSURL URLWithString:myUrlString]];
I think you should try to user NSURLMutableRequest instead in case of downloading large file so you can obtain multi-part downloading. You can also use the method expectedContentLength of NSURLResponse to know the file length. Here is an example :
didReceiveResponse:(NSURLResponse*)response {
}
}
}
And force UIWebView open that downloaded file instead of downloading from un URL.