我正在使用 appgyver 类固醇(phonegap)并尝试将照片从相机 API 保存到应用程序文件空间,以便在我重新扫描/重新加载应用程序时不会将其删除。我正在关注cordova api docs(http://docs.phonegap.com/en/1.5.0/phonegap_file_file.md.html#FileSystem)中的示例,但我从未收到过回复
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,承诺永远不会解决。