2016-08-08 38 views
0

Ich Kommissionierbelege von iCloud und Google Drive etc und mit dieser Methode - (void)documentPicker:(UIDocumentPickerViewController *)controller didPickDocumentAtURL:(NSURL *)urlErste Fehler in - (BOOL) copyItemAtURL: (NSURL *) srcURL tourl: (NSURL *) dstURL Fehler: (NSError **) Fehler

ich erhalte die uRL file:///private/var/mobile/Containers/Data/Application/34C6FC23-C8BF-407E-AD67-77758BD606E9/tmp/com.company.theApp-Inbox/chart%20(1).pdf

aber wenn ich dies tue [[NSFileManager defaultManager]copyItemAtURL:url toURL:docUrl error:&error];

ich erhalte diesen Fehler 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}

und das ist mein docUrl = /var/mobile/Containers/Data/Application/34C6FC23-C8BF-407E-AD67-77758BD606E9/Documents/documents/12345678901-1470638583.pdf

Antwort

2

Versuchen Sie, Ihre docUrl mit Initialisierung:

NSURL *docUrl = [[NSURL alloc] initFileURLWithPath:@"/var/mobile/Containers/Data/Application/34C6FC23-C8BF-407E-AD67-77758BD606E9/Documents/documents/12345678901-1470638583.pdf"]; 

Ich vermute, dass copyItemAtURL:toURL:error: nicht Ihre URL als Datei URL nicht erkennt.

+0

Dies ist, was ich NSURL * docUrl = [NSURL URLWithString: [documentFolderDataPath stringByAppendingPathComponent: fn]] tue; –

+0

Und wenn Sie das ändern zu: 'NSURL * docUrl = [NSURL-DateiURLWithPath: [documentFolderDataPath stringByAppendingPathComponent: fn]];'? – Roy

+0

Vielen Dank :) –

-3

Bitte versuchen Sie Ihre docUrl Initialisierung mit:

NSURL *docUrl = [[NSURL alloc] initFileURLWithPath:@"file:///var/mobile/Containers/Data/Application/34C6FC23-C8BF-407E-AD67-77758BD606E9/Documents/documents/12345678901-1470638583.pdf"]