how to select multiple file using UIDocumentPicker in IOS

642 views Asked by At

Through this only one file can be selected

- (void)Choose:(UIButton *)sender {
    NSArray *arry = [[NSArray alloc] initWithObjects:@"public.data", nil];
    UIDocumentPickerViewController *pickDoc = [[UIDocumentPickerViewController alloc] initWithDocumentTypes:arry inMode:UIDocumentPickerModeImport];
    pickDoc.delegate = self;
    pickDoc.modalPresentationStyle = UIModalPresentationFormSheet;
    [self presentViewController:pickDoc animated:YES completion:nil];
}

-(void)documentPicker:(UIDocumentPickerViewController *)controller didPickDocumentAtURL:(NSURL *)url {



    if (controller.documentPickerMode == UIDocumentPickerModeImport) {
        NSString *alertMessage = [NSString stringWithFormat:@"Successfully imported %@", [url lastPathComponent]];
        dispatch_async(dispatch_get_main_queue(), ^{
            UIAlertController *alertController = [UIAlertController
                                                  alertControllerWithTitle:@"Import"
                                                  message:alertMessage
                                                  preferredStyle:UIAlertControllerStyleAlert];
            [alertController addAction:[UIAlertAction actionWithTitle:@"Ok" style:UIAlertActionStyleDefault handler:nil]];
            [self presentViewController:alertController animated:YES completion:nil];
        });
    }
}
0

There are 0 answers