【问题标题】:Is it possible to write a file to the iOS filesystem with Expo so that it is accessible via the iOS 11 Files app是否可以使用 Expo 将文件写入 iOS 文件系统,以便可以通过 iOS 11 Files 应用程序访问它
【发布时间】:2018-12-16 13:12:48
【问题描述】:

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

【问题讨论】:

  • iOS 应用需要“选择加入”共享。也许从iOS 11 Files App: How to include files from app bundle开始
  • 我已将UISupportsDocumentBrowserUIFileSharingEnabled 添加到世博会的app.json 中,如下所示。我尝试了true"YES",但似乎都不起作用。我怀疑这是 Expo 尚未公开的内容:"ios": { "supportsTablet": true, "infoPlist": { "UISupportsDocumentBrowser": true, "UIFileSharingEnabled": true } }

标签: javascript ios react-native expo files-app


【解决方案1】:

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

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

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

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2019-07-30
    • 2022-06-20
    • 1970-01-01
    • 2014-02-13
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多