是否可以使用 Expo 将文件写入 iOS 文件系统,以便可以通过 iOS 11 Files 应用程序访问它 [英] Is it possible to write a file to the iOS filesystem with Expo so that it is accessible via the iOS 11 Files app

查看:22
本文介绍了是否可以使用 Expo 将文件写入 iOS 文件系统,以便可以通过 iOS 11 Files 应用程序访问它的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我目前正在使用 React Native 的 Expo 库将音频记录写入 iOS 文件系统.我正在使用 FileSystem.documentDirectory 根据 expo docs,但是在使用 iOS11 Files 应用程序时无法访问此文件.Expo是否有可能在允许这样做的地方写,或者在iCloud上写失败?FileSystem.documentDirectory 似乎是文件系统中的一个沙盒区域.

I'm currently writing an audio recording to the iOS filesystem using the Expo library for React Native. I'm using the FileSystem.documentDirectory as per the expo docs, however this file isn't accessible when using the iOS11 Files app. Is it possible with Expo to write somewhere which allows this, or failing that to iCloud? It seems like the FileSystem.documentDirectory is a sandboxed area within the filesystem.

推荐答案

实际上它看起来确实有效,但是您必须构建实际的 iOS 应用程序 .ipa 文件.它不能通过模拟器在 expo 中运行,但是一旦我通过 TestFlight 进行测试,文件确实会出现在 Files 应用程序中.

Actually it appears that it does work, but you have to build the actual iOS app .ipa file. It wasn't working from expo via simulator, but once I was testing via TestFlight the files did appear in the Files app.

Expo 的 app.jsonios 键看起来像这样.我还没有测试是否需要所有这些键:

The ios key of Expo's app.json looks like this. I haven't tested whether all of these keys are required:

"ios": {
    "infoPlist": {
        "UISupportsDocumentBrowser": true,
        "UIFileSharingEnabled": true,
        "LSSupportsOpeningDocumentsInPlace": true
    }
}

这篇关于是否可以使用 Expo 将文件写入 iOS 文件系统,以便可以通过 iOS 11 Files 应用程序访问它的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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