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

[feat] v2: Frameworks aren't being picked up for iOS builds #9962

Closed
stijnfrishert opened this issue Jun 4, 2024 · 7 comments
Closed

[feat] v2: Frameworks aren't being picked up for iOS builds #9962

stijnfrishert opened this issue Jun 4, 2024 · 7 comments

Comments

@stijnfrishert
Copy link

stijnfrishert commented Jun 4, 2024

Describe the bug

I'm using a Rust crate that depends on coreaudio-rs. For this work work on macOS/iOS, I need to link against the CoreAudio framework.

I'm building for iOS (using the v2 beta) and the linker tells me it's missing core audio symbols.

I've tried setting bundle > iOS > frameworks to [ "CoreAudio" ] in tauri.conf.json, but I get an error that the "frameworks" property is not allowed.

I've also tried setting the same on bundle > macOS > frameworks, but that doesn't help. Neither do I see --framework CoreAudio show up in the linker command.

Expected behavior

I would expect bundle > iOS > framework to be valid and insert the frameworks into the linker command

Full tauri info output

[✔] Environment
    - OS: Mac OS 14.5.0 X64
    ✔ Xcode Command Line Tools: installed
    ✔ rustc: 1.78.0 (9b00956e5 2024-04-29)
    ✔ cargo: 1.78.0 (54d8815d0 2024-03-26)
    ✔ rustup: 1.27.1 (54dd3d00f 2024-04-24)
    ✔ Rust toolchain: stable-x86_64-apple-darwin (default)
    - node: 20.12.2
    - pnpm: 9.1.2
    - npm: 10.5.0

[-] Packages
    - tauri [RUST]: 2.0.0-beta.20
    - tauri-build [RUST]: 2.0.0-beta.16
    - wry [RUST]: 0.40.0
    - tao [RUST]: 0.28.0
    - tauri-cli [RUST]: 2.0.0-beta.17
    - @tauri-apps/api [NPM]: 2.0.0-beta.12
    - @tauri-apps/cli [NPM]: 2.0.0-beta.18

[-] App
    - build-type: bundle
    - CSP: unset
    - frontendDist: ../dist
    - devUrl: http://localhost:1420/
    - framework: React
    - bundler: Vite
@stijnfrishert stijnfrishert added status: needs triage This issue needs to triage, applied to new issues type: bug labels Jun 4, 2024
@stijnfrishert stijnfrishert changed the title [bug] Frameworks aren't being picked up for iOS builds [bug] v2: Frameworks aren't being picked up for iOS builds Jun 4, 2024
@FabianLars FabianLars added type: feature request and removed type: bug status: needs triage This issue needs to triage, applied to new issues labels Jun 4, 2024
@stijnfrishert
Copy link
Author

stijnfrishert commented Jun 4, 2024

@FabianLars I'm yet unfamiliar with the Tauri internals, but if you could point me in the right direction I'm willing to try my hand at a PR :)

@stijnfrishert stijnfrishert changed the title [bug] v2: Frameworks aren't being picked up for iOS builds [feat] v2: Frameworks aren't being picked up for iOS builds Jun 4, 2024
@pewsheen
Copy link
Contributor

pewsheen commented Jun 5, 2024

I haven't tried it on the release build, but for the dev build, I think the easiest way to embed the framework now is using pnpm tauri ios open to open the project in Xcode and add the framework from it.

@stijnfrishert
Copy link
Author

stijnfrishert commented Jun 5, 2024

Thanks, @pewsheen, didn't know that was possible, so I learned something. 😄

Decided to go the PR route and learn something about Tauri's internals. Hopefully someone will pick up the PR soon and help me with some remaining questions. :)

@lucasfernog
Copy link
Member

I've got "coreaudio" to at least compile using these frameworks:

"iOS": {
      "frameworks": [
        "AudioToolbox",
        "CoreAudio",
        "OpenAL",
      ]
    }

though I didn't manage to make their Rust example work (seems like it's crashing, maybe it's missing some delegate code like they have in their iOS example)

@IT-ess
Copy link

IT-ess commented Aug 31, 2024

Hello !
Any news about a doc section for embedding frameworks into apps ? I want to use tauri-plugin-nfc on my iOS app, but I struggle with the whole dynamic framework libraries and embedding thing.

Thanks for all the work !

@stijnfrishert
Copy link
Author

From the way I've used it, it's quite easy: any of the Apple frameworks you use need to be listed under bundle/ios/frameworks in your Tauri config file, and will be picked up by the build system.

Note that you have to rerun tauri ios init to get this to work, and iirc I even had to throw away the gen/apple folder a couple of times for changes to get picked up.

As to which frameworks are required for the tauri-plugin-nfc plugin are required for it to work, I have no idea, but that should be figure-outable.

@IT-ess
Copy link

IT-ess commented Sep 2, 2024

The thing is that the framework I need, CoreNFC is a dynamic framework. And I face a lot of issues to embed this framework into my bundle, as this is required for dynamic frameworks
If I find any solution I will open a documentation PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants