tauri-apps / tauri-apps/plugins-workspace

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

Open
#2,089 5 comments 0 reactions 0 assignees View on GitHub
platform: ios plugin: dialog plugin: fs type: bug type: question
Dominant language
Rust
Stars
1.8k
Forks
602
Avg merge
4d 14h
Merged PRs (30d)
9

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.

```tsx
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 (

save file
open file

)
}

export default App

```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.