ios - Saving data to device using Parse array -
my application pulls data parse class called pdftableview , stores name of file , author tableview. programmed when user picks cell taken downloaddetailview can download file push of button. else works don't know how program button save file stored in array onto computer. here code
this segue tableview sends "pdffile" download page
detailvc.downloadfile=[[pdfarray objectatindex:indexpath.row]objectforkey:@"pdffile"];
this pulls file detail view. property declared in detail view.h
@property (retain,nonatomic) pffile * downloadfile;
and in implementation have button created , save pdf file on computer.
there ton of different ways of doing this. easiest in button targetaction:
nsdata *data = [self.downloadfile getdata]; [data writetofile:@"/path/to/save.pdf" atomically:no];
using method happen synchronously though, it'll hold main thread if don't dispatch async, or use pffile's asynchronous methods.
Comments
Post a Comment