cordova.file.*-iOS中所有位置均为空.适用于Android [英] cordova.file.* - all locations are null in iOS. Works in Android
问题描述
我正在使用cordova-file-plugin,但是它将iOS中的所有位置显示为null.这与android完美搭配.我是否缺少iOS的某些权限?
I'm using the cordova-file-plugin, but it shows all location in iOS as null. This works perfectly with android. Am I missing some permissions for iOS or something?
推荐答案
尽管@ JesseMonroy650提出了检查文档的建议(以我的经验,这通常是有问题的,不完整的文档),但在文档.这也发生在我身上,我以更加激烈的方式解决了这个问题:
Despite @JesseMonroy650's advice to check the docs (which, to my experience, tends to be a buggy, incomplete documentation), this issue is not clearly explained in the docs. It also happened to me, and I solved it in a more drastic way:
-
使用
cordova plugin rm [plugin-name]
删除org.apache.cordova.file
插件,并删除其所有从属插件(例如org.apache.cordova.file-transfer
,org.apache.cordova.media
,org.chromium.zip
和其他任何插件).要知道插件名称,请运行cordova plugins
.
Remove the
org.apache.cordova.file
plugin, and, sadly, all of its dependent plugins (likeorg.apache.cordova.file-transfer
,org.apache.cordova.media
,org.chromium.zip
and any other), usingcordova plugin rm [plugin-name]
. To know the plugin names, runcordova plugins
.
安装文件插件的较新版本.新的cordova插件具有不同的名称.要获得新名称,请将org.apache.cordova.
替换为cordova-plugin-
.在这种情况下,请使用cordova plugin add cordova-plugin-file
安装文件插件
Install the newer version of the file plugin. The new cordova plugins have a different name. To get the new name, replace org.apache.cordova.
with cordova-plugin-
. In this case, use cordova plugin add cordova-plugin-file
to install the file plugin
重新安装您必须删除的所有其他插件.您可以使用新版本(cordova-plugin-
)或旧版本(org.apache.cordova.
).我使用了file-transfer
的新版本.
Reinstall any other plugin you had to remove. You can use the new versions (cordova-plugin-
) or the old ones (org.apache.cordova.
). I used the new version of the file-transfer
.
在您的config.xml
中添加以下行:<preference name="iosPersistentFileLocation" value="Compatibility" />
或<preference name="iosPersistentFileLocation" value="Library" />
,根据您的需求.
Add in your config.xml
this line: <preference name="iosPersistentFileLocation" value="Compatibility" />
or <preference name="iosPersistentFileLocation" value="Library" />
, based on your needs.
请确保在完成这些步骤后运行cordova prepare
.
Make sure you run cordova prepare
after you complete these steps.
打开Xcode,使用⌘ + ⇧ + K 清理项目,然后使用⌘ + B .最后,使用⌘ + R 运行项目. 您还可以清理项目并使用播放按钮,但是在这种情况下,我喜欢手动执行这些步骤.是的,我有点奇怪.
Open Xcode, clean the project with ⌘+⇧+K, and then build it with ⌘+B. Finally, run the project with ⌘+R. You could also clean the project and use the play button, but in these kind of cases cases, I like to do the steps manually. Yeah, I'm a little weird.
这篇关于cordova.file.*-iOS中所有位置均为空.适用于Android的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!