iOS 调用iCloud drive的使用

配置iCloud

配置iCloud,首先要有一个真实的苹果开发者账号,然后去TARGETS -> Capabilities -> iCloud中打开相应的开关

    //跳转到iCloud并设置代理
    NSArray *documentTypes = @[@"public.content", @"public.text", @"public.source-code ", @"public.image", @"public.audiovisual-content", @"com.adobe.pdf", @"com.apple.keynote.key", @"com.microsoft.word.doc", @"com.microsoft.excel.xls", @"com.microsoft.powerpoint.ppt"];
        UIDocumentPickerViewController *documentPickerViewController = [[UIDocumentPickerViewController alloc] initWithDocumentTypes:documentTypes inMode:UIDocumentPickerModeOpen];
        documentPickerViewController.delegate = self;
        [self presentViewController:documentPickerViewController animated:YES completion:nil];

代理方法

   - (void)documentPicker:(UIDocumentPickerViewController *)controller didPickDocumentsAtURLs:(NSArray *)urls {
    
    NSLog(@"文件路径%@",urls);
 }

你可能感兴趣的:(iOS 调用iCloud drive的使用)