PhoneGap / Cordova FileEntry.CopyTo导致错误代码1000

时间:2017-08-25 00:01:33

标签: cordova android-camera phonegap-build android-file phonegap

我正在使用PhoneGap版本 cli-6.2.0 ,我遇到以下问题:使用Android手机(Pixel XL)我收到错误代码1000,如果我选择了我的图片照片库。

我被困在这里很长一段时间,有人可以帮忙吗?谢谢!

                imageURI = imageURI.split('?')[0];
                var fileEntry = new FileEntry();
                fileEntry.fullPath = imageURI; // --> file:///storage/emulated/0/Android/data/com.myapp/cache/IMG_20170822_1111111.jpg

                window.requestFileSystem(window.LocalFileSystem.PERSISTENT, 0, function(fileSystem) {
                    try {
                        fileSystem.root.getDirectory("Android/data/com.myapp/tmpphotos", { create: true, exclusive: false }, function(dir) { 
                            try {
                                var uniqName = utilities.GuidGenerator.generate()+'.jpg'; //->some GUID unique name
                                fileEntry.copyTo(dir, uniqName, function(entry) {
                                    // never executed here
                                    options.handlers.success(entry.toURI());
                                }, function(e){ alert(e.code); }); //-> error 1000 alarted here 
                            }
                            catch (e) {}

                        }, options.handlers.failure); 
                    }
                    catch(e) {
                        options.handlers.failure();
                    }

                }, options.handlers.failure);

这也是我的PhoeGapBuild配置:

 <preference name="AndroidPersistentFileLocation" value="Compatibility" />
<plugin name="cordova-plugin-camera" source="npm"></plugin>
<plugin name="cordova-plugin-file" source="npm" />

0 个答案:

没有答案