I am picking documents from iCloud and google drive etc and using this method - (void)documentPicker:(UIDocumentPickerViewController *)controller didPickDocumentAtURL:(NSURL *)url
I am getting the url file:///private/var/mobile/Containers/Data/Application/34C6FC23-C8BF-407E-AD67-77758BD606E9/tmp/com.company.theApp-Inbox/chart%20(1).pdf
but when I am doing this [[NSFileManager defaultManager]copyItemAtURL:url toURL:docUrl error:&error];
I am getting this error Error Domain=NSCocoaErrorDomain Code=262 "The file couldn’t be opened because the specified URL type isn’t supported." UserInfo={NSURL=/var/mobile/Containers/Data/Application/34C6FC23-C8BF-407E-AD67-77758BD606E9/Documents/documents/12345678901-1470638583.pdf}
and this is my docUrl = /var/mobile/Containers/Data/Application/34C6FC23-C8BF-407E-AD67-77758BD606E9/Documents/documents/12345678901-1470638583.pdf
Try initialising your docUrl
with:
NSURL *docUrl = [[NSURL alloc] initFileURLWithPath:@"/var/mobile/Containers/Data/Application/34C6FC23-C8BF-407E-AD67-77758BD606E9/Documents/documents/12345678901-1470638583.pdf"];
I'm guessing that copyItemAtURL:toURL:error:
doesn't recognise your URL as a file URL.