2014-02-09 2 views
0

appgyver 스테로이드 (phonegap)를 사용하고 사진을 카메라 파일에서 앱 파일 공간으로 저장하려고 시도하므로 다시 스캔/다시 시도 할 때 제거되지 않습니다. 앱을로드하십시오. 나는 코르도바의 API 문서 (http://docs.phonegap.com/en/1.5.0/phonegap_file_file.md.html#FileSystem)의 예를 다음 해요,하지만 난 거부/해결되지 않습니다phonegap cordova API window.requestFileSystem() LocalFileSystem.PERSISTENT

window.requestileSystem(LocalFileSystem.PERSISTENT, ...)

약속에서 응답을하지 않았다. 내가 도대체 ​​뭘 잘못하고있는 겁니까?

# in coffeescript 
console.log "1. window.deviceReady. navigator.camera"+JSON.stringify(navigator.camera), null, 10000 
_fsDeferred = $q.defer() 
window.requestFileSystem(
    LocalFileSystem.PERSISTENT, 
    50000*1024, 
    (fs)-> 
    console.log "2. window.requestFileSystem, FS= "+JSON.stringify(fs), null, 10000 
    _fsRoot = fs.root 
    _fsDeferred.resolve(_fsRoot) 
    (ev)-> 
    console.log "3. Error: requestFileSystem failed. "+ev.target.error.code, 'danger', 10000 
    _fsDeferred.reject(ev) 
) 
_fsDeferred.promise.finally()-> 
    console.log "4. window.requestFileSystem(), Deferred.promise.finally(), args"+JSON.stringify arguments, 'danger', 10000 

나는 # 4에 결코 도달하지 않습니다. 약속은 결코 해결되지 않습니다.

답변

1

여기에 AppGyver 직원 - 코드에서 간단한 repro를 만들었으므로 제대로 작동하는 것 같습니다. repro here을 참조하십시오.

fs이 순환 구조이고, JSON.stringify이 직렬화 할 수 없기 때문에 코드를 실행하는 중 오류가 발생했습니다. JSON.stringify(fs)이 실패했습니다. console.log(fs)을 수행하는 경우 파일 시스템 객체가 정상적으로 처리됩니다 (애플리케이션로드시 발생하는 일들을 잡으려면 Safari Web Inspector에서 location.reload()을 수행해야 할 수도 있음).

+0

죄송합니다. appgyver 포럼에서 내 대답을 업데이트했지만 여기에서 동일한 작업을 수행하는 것을 잊었습니다. – michael