Skip to content

[dialog] [iOS] open([options]) brings up photo picker and not file select #1578

Open
@bjbk

Description

@bjbk

Install plugin-dialog using manual install
JS API installed with pnpm

Import plugin-dialog and then use the following code:

await open({
      multiple: false,
      directory: false,
      properties: [{ mimeTypes: ['text/csv'] }],
      filters: [{ name: 'CSV', extensions: ['csv'] }],
    })

Running pnpm tauri dev for desktop, the code brings up a file picker dialog as expected allowing the selection of a CSV file.

iOS issue

Running pnpm tauri ios dev choosing a simulator then when the app is running, tap the button to bring up the file picker. The photo app picker is what comes up. No other means to select a file from the Files app. A photo can be selected and returned. What is needed though is a means to select a file not a photo.

Expected open file picker dialog

Tied setting permissions in capabilities individually. No change

Other information

capabilities/default.json

{
  "$schema": "../gen/schemas/desktop-schema.json",
  "identifier": "default",
  "description": "Capability for the main window",
  "windows": [
    "main"
  ],
  "permissions": [
    "store:default",
    "store:allow-get",
    "store:allow-set",
    "store:allow-save",
    "store:allow-load",
    "store:allow-clear",
    "store:allow-delete",
    "store:allow-has",
    "store:allow-keys",
    "store:allow-length",
    "store:allow-reset",
    "store:allow-values",
    "path:default",
    "event:default",
    "window:default",
    "app:default",
    "image:default",
    "resources:default",
    "menu:default",
    "tray:default",
    "shell:allow-open",
    "fs:default",
    "dialog:default"
  ]
}

package.json

...
"@tauri-apps/plugin-dialog": "2.0.0-beta.7",
...

lib.rs

use tauri::Manager;

#[cfg_attr(mobile, tauri::mobile_entry_point)]
pub fn run() {
    let mut builder = tauri::Builder::default()
        .setup(|app| {
            #[cfg(debug_assertions)]
            {
                let window = app.get_webview_window("main").unwrap();
                window.open_devtools();
                window.close_devtools();
            }
            Ok(())
        })
        .plugin(tauri_plugin_dialog::init())
        .plugin(tauri_plugin_fs::init())
        .plugin(tauri_plugin_shell::init())
        .plugin(tauri_plugin_os::init())
        .plugin(tauri_plugin_store::Builder::new().build());

    #[cfg(not(target_os = "ios"))]
    {
        builder = builder.plugin(tauri_plugin_window_state::Builder::default().build());
    }

    builder
        .run(tauri::generate_context!())
        .expect("error while running tauri application");
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions