tauri-apps / tauri

Build smaller, faster, and more secure desktop applications with a web frontend.
https://tauri.app
Apache License 2.0
81.98k stars 2.46k forks source link

[bug] resource_dir_from() function, used for looking up resource files - not yet implemted for IOS? #10070

Open lyager opened 3 months ago

lyager commented 3 months ago

Describe the bug

Not sure to classify this as a bug, I know that you are working hard on getting V2 ready.

I've been looking at adding binary files to my IOS app, but traced the error down to the above mentioned function returning Err:UnsupportedPlatform. I'm uncertain how this is intended to work under IOS?

Reproduction

Calling const allFiles = await readDir('.', { baseDir: BaseDirectory.Resource, }); will throw error unknown path

Expected behavior

Content of resource folder should be returned.

Full tauri info output

[✔] Environment
    - OS: Mac OS 14.5.0 X64
    ✔ Xcode Command Line Tools: installed
    ✔ rustc: 1.77.2 (25ef9e3d8 2024-04-09)
    ✔ cargo: 1.77.2 (e52e36006 2024-03-26)
    ✔ rustup: 1.27.1 (2024-04-24)
    ✔ Rust toolchain: stable-aarch64-apple-darwin (environment override by RUSTUP_TOOLCHAIN)
    - node: 20.14.0
    - pnpm: 9.1.4
    - yarn: 1.22.21
    - npm: 10.7.0

[-] Packages
    - tauri [RUST]: 2.0.0-beta.22
    - tauri-build [RUST]: no manifest (2.0.0-beta.17, 2.0.0-beta.17)
    - wry [RUST]: 0.40.1
    - tao [RUST]: 0.28.1
    - tauri-cli [RUST]: 2.0.0-beta.20
    - @tauri-apps/api [NPM]: 2.0.0-beta.13
    - @tauri-apps/cli [NPM]: 2.0.0-beta.20

[-] App
    - build-type: bundle
    - CSP: unset
    - frontendDist: ../dist/spa
    - devUrl: http://localhost:9000/
    - framework: Vue.js (Quasar)
    - bundler: Vite

Stack trace

No response

Additional context

No response

mrguiman commented 2 months ago

I might be mistaken but I've looked into a little bit as well and apart from the resource_dir_from function, it seems to me like the cli would also need to copy the resources to xcodeproj's Assets folder for this to work - I don't think the target folder is of any help when the app is bundled (which should always be the case when running with ios ?)

winjeysong commented 1 month ago

I encountered the same problem on macOS iphone15pro simulator. I'm not familiar with native ios, maybe is there a temp way to bypass it? @lyager

lyager commented 1 month ago

@winjeysong the manual work around for me was to copy the binary files I needed manually into the IPA package.

winjeysong commented 1 month ago

@winjeysong the manual work around for me was to copy the binary files I needed manually into the IPA package.

Thank you for your reply. My binary files are generated by users dynamically, so I can't copy files manually. :-(