我有一个iPad应用程序,需要从iCloud获取PDF和视频,在Web视图中打开PDF,然后将索引路径保存在文档中,然后需要在另一个视图中打开它并保存在文档中。 / p>
到目前为止,我可以打开iCloud并使用以下代码下载:
(IBAction)openIcloud:(id)sender {
UIDocumentPickerViewController *documentPicker = [[UIDocumentPickerViewController alloc] initWithDocumentTypes:@[@"public.data"] inMode:UIDocumentPickerModeImport];
documentPicker.delegate = self;
documentPicker.modalPresentationStyle = UIModalPresentationFormSheet;
[self presentViewController:documentPicker animated:YES completion:nil];
}
答案 0 :(得分:0)
您非常接近,只是缺少这样的东西
#pragma mark - iCloud files
- (void)documentPicker:(UIDocumentPickerViewController *)controller didPickDocumentAtURL:(NSURL *)url {
if (controller.documentPickerMode == UIDocumentPickerModeImport) {
docController =[UIDocumentInteractionController interactionControllerWithURL: url];
//NSURL *url = [NSURL fileURLWithPath:documentPickerMode];
NSURLRequest *requestObj = [NSURLRequest requestWithURL:url];
[MywebWiev setUserInteractionEnabled:YES];
[MywebWiev setDelegate:self];
MywebWiev.scalesPageToFit = YES;
[MywebWiev loadRequest:requestObj];
}
}
- (IBAction)Pdf001:(id)sender {
UIDocumentPickerViewController *documentPicker = [[UIDocumentPickerViewController alloc] initWithDocumentTypes:@[@"public.data"] inMode:UIDocumentPickerModeImport];
documentPicker.delegate = self;
documentPicker.modalPresentationStyle = UIModalPresentationFormSheet;
[self presentViewController:documentPicker animated:YES completion:nil];
}
remember call <UIDocumentPickerDelegate,UIWebViewDelegate>
祝你生日快乐