我想通过模拟器从Parse中提取PDF文件,并在我的应用程序上单击按钮时将其保存到我的桌面上.问题是,无论我做什么文件都不会出现在桌面上或其他任何地方.我正在使用此方法下载我的按钮
-(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...");
}
}];
}
Run Code Online (Sandbox Code Playgroud)
downloadFile是一个PFFile属性,当我移动它通过segue时,它存储我的PDF文件的索引.它声明如下:
@property (retain,nonatomic) PFFile * downloadfile;
Run Code Online (Sandbox Code Playgroud)
这是segue:
detailVC.downloadfile=[[PDFArray objectAtIndex:indexPath.row]objectForKey:@"PDFFile"];
Run Code Online (Sandbox Code Playgroud)
无法将其保存到桌面.