tauri icon indicating copy to clipboard operation
tauri copied to clipboard

[bug] Bundle built with tauri ios build contains standalone libraries

Open jgonera opened this issue 6 months ago • 1 comments

Describe the bug

I'm trying to release my mobile app in TestFlight. I'm using Transporter to upload the .ipa but I get the following error:

Invalid bundle structure. The “ScribbleScan.app/libapp.a” binary file is not permitted. Your app cannot contain standalone executables or libraries, other than a valid CFBundleExecutable of supported bundles. For details, visit: https://developer.apple.com/documentation/bundleresources/placing_content_in_a_bundle

I tried building my app with both of these commands but the result is the same:

npx tauri ios build --export-method release-testing
npx tauri ios build --export-method app-store-connect

Reproduction

No response

Expected behavior

No response

Full tauri info output

[✔] Environment
    - OS: Mac OS 15.5.0 arm64 (X64)
    ✔ Xcode Command Line Tools: installed
    ✔ rustc: 1.87.0 (17067e9ac 2025-05-09)
    ✔ cargo: 1.87.0 (99624be96 2025-05-06)
    ✔ rustup: 1.28.2 (e4f3ad6f8 2025-04-28)
    ✔ Rust toolchain: 1.87.0-aarch64-apple-darwin (overridden by environment variable RUSTUP_TOOLCHAIN)
    - node: 22.15.1
    - npm: 10.9.2

[-] Packages
    - tauri 🦀: 2.2.5
    - tauri-build 🦀: 2.0.5
    - wry 🦀: 0.48.1
    - tao 🦀: 0.31.1
    - @tauri-apps/api : 2.2.0 (outdated, latest: 2.5.0)
    - @tauri-apps/cli : 2.2.7 (outdated, latest: 2.5.0)

[-] Plugins
    - tauri-plugin-fs 🦀: 2.2.0
    - @tauri-apps/plugin-fs : 2.2.0 (outdated, latest: 2.3.0)
    - tauri-plugin-sql 🦀: 2.2.0
    - @tauri-apps/plugin-sql : 2.2.0
    - tauri-plugin-dialog 🦀: 2.2.0
    - @tauri-apps/plugin-dialog : 2.2.0 (outdated, latest: 2.2.2)
    - tauri-plugin-opener 🦀: 2.2.5
    - @tauri-apps/plugin-opener : 2.2.5 (outdated, latest: 2.2.7)
    - tauri-plugin-http 🦀: 2.3.0
    - @tauri-apps/plugin-http : 2.3.0 (outdated, latest: 2.4.4)

[-] App
    - build-type: bundle
    - CSP: style-src 'unsafe-inline' 'self'; default-src 'self'; img-src 'self' asset: http://asset.localhost; connect-src ipc: http://ipc.localhost
    - frontendDist: ../dist
    - devUrl: http://localhost:1420/
    - framework: React
    - bundler: Vite

[-] iOS
    - Developer Teams: [redacted]

Stack trace


Additional context

No response

jgonera avatar Jun 05 '25 23:06 jgonera

I was able to fix this by removing libapp.a from Build Phases -> Copy Bundle Resources section in XCode:

Image

I'm pretty new to both Tauri and iOS so I'm not sure if this will mess up my dev builds / debugging. I did notice that the resulting .ipa dropped in size from ~100MB to ~5MB (apart from successfully uploading in the Transporter app).

jgonera avatar Jun 06 '25 00:06 jgonera

I just got this error all of a sudden.

setoelkahfi avatar Jun 29 '25 18:06 setoelkahfi

I had this error too on my first attempt to upload to AppStore Connect and following the official docs. Following @jgonera's advice and deleting libapp.a did the trick but I have the impression that this is not the correct solution.

mike-lloyd03 avatar Aug 21 '25 22:08 mike-lloyd03

I'm now seeing both debug and release versions of libapp.a being added to the build. Having both generates a different error. Removing debug and leaving release generates the same error as above.

Image

Removing libapp.a allows the upload to proceed as stated previously, but my app has no CSS once I'm running it through TestFlight. I'm not sure if this is related or a different issue,

mike-lloyd03 avatar Aug 28 '25 17:08 mike-lloyd03

that's weird.. when i create a project I don't have the libapp.a in the "copy bundle resources" list... do you know when that was added? is it something that Xcode is doing? that's not needed at all I've shipped a few Tauri apps on testflight with no such problem at all

lucasfernog avatar Aug 28 '25 18:08 lucasfernog

the libapp.a should only be part of the "Link Binary With Libraries" section, not the "Copy Bundle Resources" one

lucasfernog avatar Aug 28 '25 18:08 lucasfernog

Both of the libapp.a files are appearing in the "copy bundle" section after I run tauri ios init. I'll delete them but I'm not sure why it's happening in the first place or if that's the reason why my built app has almost no CSS.

mike-lloyd03 avatar Aug 28 '25 19:08 mike-lloyd03

I don't think that's the cause of the missing CSS - make sure the dist folder has all the files you need and open the inspector in safari to debug this

lucasfernog avatar Aug 28 '25 20:08 lucasfernog

For me, running tauri ios init puts libapp.a in the link binaries section (tauri v2). I had a issue with failing simulator builds and deleting the gen/ folder and re-running the ios init command was what fixed it.

I don't think it's related to CSS issues though; that's likely an asset bundling issue or a CSP issue that's preventing your css file from being loaded in the webview.

Image

UdaraJay avatar Sep 08 '25 16:09 UdaraJay

Cleaning up the gen/apple folder fixes the issue for me ✅

setoelkahfi avatar Sep 14 '25 13:09 setoelkahfi