I am trying to pull a PDF file from Parse through Simulator and save it onto my Desktop when a button is clicked on my app. Problem is that no matter what i do file doesn't show up on Desktop nor anywhere else. I am using this method for my download button
-(void) Savefile {
NSFileManager *filemanager = [NSFileManager defaultManager];
[self.downloadfile getDataInBackgroundWithBlock:^(NSData *data, NSError *error) {
if (error) {
}
else if (data) {
[filemanager createFileAtPath:@"file:///Users/Danny/Desktop" contents:data attributes:nil];
[data writeToFile:@"file:///Users/Danny/Desktop" atomically:NO ];
NSLog(@"Downloading file...");
}
}];
}
downloadFile is a PFFile property that stores the index of my PDFfile as i move it through segue. Its declared as this:
@property (retain,nonatomic) PFFile * downloadfile;
this here is the segue:
detailVC.downloadfile=[[PDFArray objectAtIndex:indexPath.row]objectForKey:@"PDFFile"];
can't get it to save to desktop.