Skip to content

[bug] Using plugin-dialog and plugin-fs to write file on iOS is ineffective. #2089

Open
@nashaofu

Description

Replicate the code:https://github.com/shell360/tauri-issue
The replication steps:

  1. git clone https://github.com/shell360/tauri-issue.git
  2. cd tauri-issue && pnpm install
  3. run pnpm tauri ios dev,And select the iOS simulator.
  4. click save file button
  5. When checking the file in iOS file management, it was found that the content was not successfully written.
import { useCallback, useState } from 'react'
import { save, open } from '@tauri-apps/plugin-dialog'
import { writeFile, readFile } from '@tauri-apps/plugin-fs'

function App() {
  const onSave = useCallback(async () => {
    const path = await save()
    if (!path) {
      return
    }

    let encoder = new TextEncoder()
    let data = encoder.encode('Hello World')
    await writeFile(path, data) // The content was not successfully written.
  }, [])

  const onOpen = useCallback(async () => {
    const path = await open()
    if (!path) {
      return
    }

    let content = await readFile(path)
    console.log(content)
  }, [])
  
  return (
    <main className="container">
      <button onClick={onSave}>save file</button>
      <button onClick={onOpen}>open file</button>
    </main>
  )
}

export default App

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingplatform: iosiOS specific issuesplugin: dialogplugin: fsIncludes former "fs-extra" and "fs-watch" pluginsquestionFurther information is requested

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions