本文介绍了cordova ios cordova.file.applicationDirectory中的resolveLocalFileSystemURL ENCODING_ERR的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

window.resolveLocalFileSystemURL(cordova.file.applicationDirectory +'www/tutorial/comic.json')

window.resolveLocalFileSystemURL(cordova.file.applicationDirectory + 'www/tutorial/comic.json')

在设备上使用ENCODING_ERR导致失败回调.在iOS模拟器中可以正常运行.

results in the failure callback with ENCODING_ERR on device. Works FINE in ios simulator.

iosPersistentFileLocation =库

iosPersistentFileLocation = Library

iosExtraFilesystems =包,库,库不同步

iosExtraFilesystems = bundle, library, library-nosync

完整路径:

在设备上-文件:///private/var/mobile/Containers/Bundle/Application/0E3CD0FD-BC69-42D1-BBB2-C59682E7F29A/My%20Comics.app/www/tutorial/comic.json

on the device-file:///private/var/mobile/Containers/Bundle/Application/0E3CD0FD-BC69-42D1-BBB2-C59682E7F29A/My%20Comics.app/www/tutorial/comic.json

模拟器-文件:///Users/admin/Library/Developer/CoreSimulator/Devices/80E29D25-5164-4869-81F9-E30571D2BE92/data/Containers/Bundle/Application/650AE88A-FD42-469B-90FE-494DF11CFA02/My%20Comics.app/www/tutorial/comic.json

simulator-file:///Users/admin/Library/Developer/CoreSimulator/Devices/80E29D25-5164-4869-81F9-E30571D2BE92/data/Containers/Bundle/Application/650AE88A-FD42-469B-90FE-494DF11CFA02/My%20Comics.app/www/tutorial/comic.json

推荐答案

您需要在iosExtraFilesystems中扎根.即使文档说它是默认加载的.这样就解决了.

You neeed root in your iosExtraFilesystems. Even though the docs say it loaded by default. This fixed it.

iosExtraFilesystems =根目录,捆绑包,库,库无同步

iosExtraFilesystems = root, bundle, library, library-nosync

这篇关于cordova ios cordova.file.applicationDirectory中的resolveLocalFileSystemURL ENCODING_ERR的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-21 20:08