In IOS (object-c), it is quite easy to download and view PDF files. Before downloading, you must first pass the directory of the IOS file that can be saved again:
IOS file storage directory
IOS can customize the file directories to be written, which is very limited. Only these three directories can be used:
1. NSDocumentDirectory
Download the file to this directory. You can use iTunes to view the file directly. For files that are not secure and easy to browse, you can download them to this directory as pdf. ,
2. NSLibraryDirectory
If the file is downloaded to this directory, the file cannot be directly viewed using iTunes. You can only view the file in the APP. You can download the file to this directory for security considerations.
3. NSCachesDirectory
This directory stores cached files, such as cached image data. It is not suitable for storing permanent files.
This article prohibits reprinting on any website and severely condemn the worms.
This article was first published in, blog garden. Please search: blog garden-Find yourself and view the original article
This article first address: IOS download view PDF file (with download progress)-http://www.cnblogs.com/xunziji/p/3242843.html
Download pdf files for IOS
In the IOS development process has been used AFNetworking (https://github.com/AFNetworking/AFNetworking) responsible for network communication, and this open-source component is very stable, easy to use, at the same time also a lot of people, various online solutions are available. This component is also used for this download.
* paths =* _filePath = [paths objectAtIndex:NSString* fileUrl = fileUrl = [fileUrl stringByReplacingOccurrencesOfString: withString:NSURLRequest* request =* fileName = * filePath =AFURLConnectionOperation *operation ==^(NSUInteger bytesRead, totalBytesRead, progress = ()totalBytesRead / (progress == [operation setCompletionBlock:^
This article prohibits reprinting on any website and severely condemn the worms.
This article was first published in, blog garden. Please search: blog garden-Find yourself and view the original article
This article first address: IOS download view PDF file (with download progress)-http://www.cnblogs.com/xunziji/p/3242843.html
View PDF files
There are many ways to view PDF files in IOS, but WebView is the easiest and most convenient, although not the most powerful.
NSArray* paths =* filePath = [paths objectAtIndex:* fileName = *path ===* url =*request =
This article prohibits reprinting on any website and severely condemn the worms.
This article was first published in, blog garden. Please search: blog garden-Find yourself and view the original article
This article first address: IOS download view PDF file (with download progress)-http://www.cnblogs.com/xunziji/p/3242843.html