cordova.file.*-iOS中所有位置均为空.适用于Android [英] cordova.file.* - all locations are null in iOS. Works in Android

查看:51
本文介绍了cordova.file.*-iOS中所有位置均为空.适用于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:

  1. 使用cordova plugin rm [plugin-name]删除org.apache.cordova.file插件,并删除其所有从属插件(例如org.apache.cordova.file-transferorg.apache.cordova.mediaorg.chromium.zip和其他任何插件).要知道插件名称,请运行cordova plugins.

  1. Remove the org.apache.cordova.file plugin, and, sadly, all of its dependent plugins (like org.apache.cordova.file-transfer, org.apache.cordova.media, org.chromium.zip and any other), using cordova plugin rm [plugin-name]. To know the plugin names, run cordova 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-fileto 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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆