새로운 라이온의 샌드 박스를 이해하는 데 약간의 문제가 있습니다.NSSavePanel 및 샌드 박스
라이온에는 샌드 박스 응용 프로그램 대신 열기/저장 대화 상자를 제시하고 제어하는 작업 인 Powerbox
이라는 신뢰할 수있는 데몬 프로세스가 포함되어 있습니다. Code Signing And Application Sandboxing Guide처럼
는 말한다 :
Any time an application running inside a sandbox invokes an NSOpenPanel or NSSavePanel dialog, rather than showing the panels directly, AppKit automatically asks the Powerbox to present the dialog. From a developer perspective, there are no code changes required in terms of how these panels are used; this process is fully transparent.
After the user selects a set of files or directories, the Powerbox uses new functionality in the sandbox kernel module to expand the invoking application's sandbox to allow access to the selected files. By the time the application code queries the panel for the returned URLs or filenames, it already has permission to access those files, and can continue to use the files through almost any API it already uses.
좋아. 이 코드를 사용하여 몇 가지 구체적인 테스트를했다 :
NSSavePanel *savePanel = [NSSavePanel savePanel];
savePanel.delegate = self;
savePanel.directoryURL = ...;
savePanel.nameFieldStringValue = ...;
[savePanel beginSheetModalForWindow:self.window
completionHandler:^(NSInteger returnCode) {
/* the completion handler */
}];
이상한 것은이 완료 핸들러 전에 호출되는 NSOpenSavePanelDelegate
방법의가, 가 파일 시스템에있는 파일에 액세스 할 수없는 것입니다.
이 정보가 맞습니까?
그렇다면 panel:validateURL:error:
과 같은 대리인의 메서드는 쓸모 없게됩니다.
앱과 Powerbox
사이의 연결을보다 자세하게 설명 할 수 있습니까?
'validateURL :'메소드가 파일 시스템에 액세스해야하는 이유는 무엇입니까? 해당 파일의 URL이 위임 메소드로 전달되며, 그 밖의 필요한 사항은 무엇입니까? –
예를 들어, 지정된 URL이 쓰기 가능한지 분석하고 싶습니다. 그렇지 않으면 'NO'를 반환합니다. – Dev
어쨌든'NSOpenSavePanelDelegate'의 메소드가 파일 시스템에 접근 할 수 없다는 것을 나에게 확인할 수 있습니까? 완료 핸들러 만 선택한 파일에 액세스 할 수 있습니까? (제 공식적인 문서는 부족합니다.) – Dev