현재 이동 및 내보내기 기능을 구현하려고합니다. 사용자가 이동/파일 내보내기를 원하는 디렉토리로 이동 한 다음 선택한 디렉토리에서 dismissGrantingAccessToURL을 호출하고 원본 파일의 파일 이름을 추가하면됩니다. 여기 코드에서 보이는 방법은 다음과 같습니다이동 또는 내보내기 모드의 DocumentPickerViewController가 존재하지 않는 URL로 해제되었습니다 (문서 공급자 앱 확장 만들기)
문서는 다음 말한다let moveDestinationPath = self.currentDirectory.path.stringByAppendingPathComponent(AppHelper.Stored.originalURL!.lastPathComponent)
delegate.finishWithURL(NSURL.fileURLWithPath(moveDestinationPath))
나는이 주어진 충분해야한다고 생각
:
Export Document Picker mode. Provide a URL for the selected destination. This URL needs to be accessible only by the Document Picker View Controller extension. The system saves a copy of the document at this URL and returns the URL to the host app to indicate success. The host app cannot access the document at this URL.
Move Document Picker mode. Provide a URL for the selected destination. The URL needs to be contained inside the hierarchy referred to by your documentStorageURL property. The system moves the document to this URL and returns the URL to the host app. The host app can then access the document at the new URL.
그러나, 나는이 코드를 실행할 때, 나는 다음과 같은 오류가 발생합니다 :
Terminating app due to uncaught exception 'NSInternalInconsistencyException',
reason: '<TestDocumentProvider.DocumentPickerViewController: 0x7c470770> was
dismissed with a nonexistent URL (file:///Users/test/Library/Developer/CoreSimulator
/Devices/6867B1A7-8694-4D6D-8480-69FE89F39C27/data/Containers/Shared/AppGroup/74A2FBED-
70C5-4F24-8345-AD35FEB86D01/FileProviderStorage/Directory1/apple1.png)
in Move or Export mode'
이 오류가 발생하면 직접 원래 URL로 파일을 이동하거나 복사하려고합니다. 그러나 이것은 문서가 말하는 것과 모순됩니다 (시스템이 그것을 수행하는 부분).
그렇다면이 상황에서 Apple이 내게 무엇을 하려는지 알 수 있습니까? 지금은 아마도 그냥 이동/복사 자신을 수행하는 경로를 갈거야 ...