Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
nashaofu opened this issue Nov 23, 2024 · 0 comments
Labels
bug Something isn't working platform: ios iOS specific issues plugin: dialog plugin: fs Includes former "fs-extra" and "fs-watch" plugins question Further information is requested

Comments

@nashaofu
Copy link
Contributor

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
@nashaofu nashaofu changed the title [bug] Using plugin-open and plugin-fs to write files on iOS is ineffective. [bug] Using plugin-open and plugin-fs to write file on iOS is ineffective. Nov 23, 2024
@nashaofu nashaofu changed the title [bug] Using plugin-open and plugin-fs to write file on iOS is ineffective. [bug] Using plugin-dialog and plugin-fs to write file on iOS is ineffective. Nov 23, 2024
@FabianLars FabianLars added bug Something isn't working question Further information is requested plugin: dialog plugin: fs Includes former "fs-extra" and "fs-watch" plugins platform: ios iOS specific issues labels Nov 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working platform: ios iOS specific issues plugin: dialog plugin: fs Includes former "fs-extra" and "fs-watch" plugins question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants