2016-05-31 73 views
7

Uygulamamdaki belgeye (pdf, doc, docx) seçim yapmak istiyorum. Bunun için iCloud'u entegre etmek istiyorum. Tek yapmak istediğim, iCloud sürücüsünü uygulamamdan açmak ve kullanıcı dosyayı seçip orijin uygulamasına geri dönmektir. IOS uygulamasında belge seçimi için whatsapp'ın yaptığı bir şey.iOS uygulamasında iCloud Drive'ı aç

Bununla ilgili bir fikriniz var mı? Aşağıda https://developer.apple.com/library/ios/documentation/FileManagement/Conceptual/DocumentPickerProgrammingGuide/AccessingDocuments/AccessingDocuments.html

kodudur:

cevap

12

Aşağıdaki fikri alacak bağlantısını bunu oku bunun için

-(IBAction)iCloudDriveFullFolder:(id)sender{ 
UIDocumentPickerViewController *documentPicker = [[UIDocumentPickerViewController alloc] initWithDocumentTypes:@[@"public.data"] 
                               inMode:UIDocumentPickerModeImport]; 
     documentPicker.delegate = self; 

    documentPicker.modalPresentationStyle = UIModalPresentationFormSheet; 
    [self presentViewController:documentPicker animated:YES completion:nil]; 
} 


#pragma mark - iCloud files 
- (void)documentPicker:(UIDocumentPickerViewController *)controller didPickDocumentAtURL:(NSURL *)url { 
    if (controller.documentPickerMode == UIDocumentPickerModeImport) { 
     // NSString *alertMessage = [NSString stringWithFormat:@"Successfully imported %@", [url lastPathComponent]]; 
     //do stuff 

    } 
} 
+1

Dostum çok teşekkürler, çok uzun zamandır bu sorun takılıp oldum ve ben kam Bu ve her şey çalıştı! TEŞEKKÜR EDERİM! –

+0

@LazarKukolj Her zaman hoşgeldin kardeşim :-) –

+0

@Rohitax Rajguru Lütfen cevabımı kabul edin :-) –

İlgili konular