Open
Description
Replicate the code:https://github.com/shell360/tauri-issue
The replication steps:
git clone https://github.com/shell360/tauri-issue.git
cd tauri-issue && pnpm install
- run
pnpm tauri ios dev
,And select the iOS simulator. - click
save file
button - 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