简体   繁体   中英

How do I download or open .docx,.pdf,.zip and video file from internet in iphone/ipad SDK

Developing an iPad/iphone app below are my requirements: I'm consuming webservice where i get the list of absolute internet file paths (.docx, .pdf, .zip, video) and file names that are displaying in UITableView. Now when I click on any file it should give me few options download,save or open.

The query is how do I open and save these files using iphone/ipad SDK.

I tried this code [but] its opening in Browser.

[[UIApplication sharedApplication] openURL:[NSURL URLWithString:myFilePath]];

Thanks in advance..

For downloading and saving file there are many methods available. One of them is explained in following answer.

method to download mp3 file from url

Other possible option can be to download file in form in synchronous form. One possible way can be using

[NSData dataWithContentOfURL:] ;

Above will rerurn autoreleased datawhich can be saved to fileusing full path.

Opening file is a matter that depends upon type of file so for that you have to look for how you can open particular file.

If you need any help regarding how to make destination location path etc. then there are many other post available for that. Or you can post here also.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM