From 42ae8b4501f3628cddeab3973eb38a7593304cc8 Mon Sep 17 00:00:00 2001 From: takakix2 Date: Sat, 10 Oct 2026 20:09:53 +0900 Subject: [PATCH] fix(ios): make `init_plugin_*` entry points public so release builds link on Xcode 27 (#3684) * fix(ios): make `init_plugin_*` entry points public so release builds link on Xcode 27 Xcode 27's SwiftPM (Swift Build) gives non-public @_cdecl functions local visibility in release builds, so each plugin's init_plugin_* is undefined when Rust links. Mark them public in the 11 plugins with an iOS part. See tauri-apps/tauri#16130 Co-Authored-By: Claude Opus 5.5 (1M context) * Apply suggestion from @lucasfernog --------- Co-authored-by: takakix2 <1370181+takakix2@users.noreply.github.com> Co-authored-by: Claude Opus 5.5 (1M context) Co-authored-by: Lucas Fernandes Nogueira --- .changes/ios-public-init-plugin.md | 26 +++++++++++++++++++ .../ios/Sources/BarcodeScannerPlugin.swift | 2 +- .../ios/Sources/BiometricPlugin.swift | 2 +- .../ios/Sources/ClipboardPlugin.swift | 2 +- plugins/dialog/ios/Sources/DialogPlugin.swift | 2 +- .../ios/Sources/GeolocationPlugin.swift | 2 +- .../haptics/ios/Sources/HapticsPlugin.swift | 2 +- plugins/log/ios/Sources/LogPlugin.swift | 2 +- plugins/nfc/ios/Sources/NfcPlugin.swift | 2 +- .../ios/Sources/NotificationPlugin.swift | 2 +- plugins/opener/ios/Sources/OpenerPlugin.swift | 2 +- plugins/shell/ios/Sources/ShellPlugin.swift | 2 +- 12 files changed, 37 insertions(+), 11 deletions(-) create mode 100644 .changes/ios-public-init-plugin.md diff --git a/.changes/ios-public-init-plugin.md b/.changes/ios-public-init-plugin.md new file mode 100644 index 000000000..65564277e --- /dev/null +++ b/.changes/ios-public-init-plugin.md @@ -0,0 +1,26 @@ +--- +barcode-scanner: patch +biometric: patch +clipboard-manager: patch +dialog: patch +geolocation: patch +haptics: patch +log: patch +nfc: patch +notification: patch +opener: patch +shell: patch +barcode-scanner-js: patch +biometric-js: patch +clipboard-manager-js: patch +dialog-js: patch +geolocation-js: patch +haptics-js: patch +log-js: patch +nfc-js: patch +notification-js: patch +opener-js: patch +shell-js: patch +--- + +On iOS, mark the plugin's `init_plugin_*` entry point `public` so release builds made with Xcode 27 keep it global and link. diff --git a/plugins/barcode-scanner/ios/Sources/BarcodeScannerPlugin.swift b/plugins/barcode-scanner/ios/Sources/BarcodeScannerPlugin.swift index 96996cabe..fc6493dd9 100644 --- a/plugins/barcode-scanner/ios/Sources/BarcodeScannerPlugin.swift +++ b/plugins/barcode-scanner/ios/Sources/BarcodeScannerPlugin.swift @@ -346,6 +346,6 @@ class BarcodeScannerPlugin: Plugin, AVCaptureMetadataOutputObjectsDelegate { } @_cdecl("init_plugin_barcode_scanner") -func initPlugin() -> Plugin { +public func initPlugin() -> Plugin { return BarcodeScannerPlugin() } diff --git a/plugins/biometric/ios/Sources/BiometricPlugin.swift b/plugins/biometric/ios/Sources/BiometricPlugin.swift index c295904aa..4901fdfd6 100644 --- a/plugins/biometric/ios/Sources/BiometricPlugin.swift +++ b/plugins/biometric/ios/Sources/BiometricPlugin.swift @@ -148,6 +148,6 @@ class BiometricPlugin: Plugin { } @_cdecl("init_plugin_biometric") -func initPlugin() -> Plugin { +public func initPlugin() -> Plugin { return BiometricPlugin() } diff --git a/plugins/clipboard-manager/ios/Sources/ClipboardPlugin.swift b/plugins/clipboard-manager/ios/Sources/ClipboardPlugin.swift index cb4fc9b2b..11398ef6e 100644 --- a/plugins/clipboard-manager/ios/Sources/ClipboardPlugin.swift +++ b/plugins/clipboard-manager/ios/Sources/ClipboardPlugin.swift @@ -47,6 +47,6 @@ class ClipboardPlugin: Plugin { } @_cdecl("init_plugin_clipboard") -func initPlugin() -> Plugin { +public func initPlugin() -> Plugin { return ClipboardPlugin() } diff --git a/plugins/dialog/ios/Sources/DialogPlugin.swift b/plugins/dialog/ios/Sources/DialogPlugin.swift index 719c3459b..935e5db76 100644 --- a/plugins/dialog/ios/Sources/DialogPlugin.swift +++ b/plugins/dialog/ios/Sources/DialogPlugin.swift @@ -308,6 +308,6 @@ class DialogPlugin: Plugin { } @_cdecl("init_plugin_dialog") -func initPlugin() -> Plugin { +public func initPlugin() -> Plugin { return DialogPlugin() } diff --git a/plugins/geolocation/ios/Sources/GeolocationPlugin.swift b/plugins/geolocation/ios/Sources/GeolocationPlugin.swift index 7a2b57a95..66b946a44 100644 --- a/plugins/geolocation/ios/Sources/GeolocationPlugin.swift +++ b/plugins/geolocation/ios/Sources/GeolocationPlugin.swift @@ -245,6 +245,6 @@ class GeolocationPlugin: Plugin, CLLocationManagerDelegate { } @_cdecl("init_plugin_geolocation") -func initPlugin() -> Plugin { +public func initPlugin() -> Plugin { return GeolocationPlugin() } diff --git a/plugins/haptics/ios/Sources/HapticsPlugin.swift b/plugins/haptics/ios/Sources/HapticsPlugin.swift index 4889c8adf..c8f408966 100644 --- a/plugins/haptics/ios/Sources/HapticsPlugin.swift +++ b/plugins/haptics/ios/Sources/HapticsPlugin.swift @@ -128,6 +128,6 @@ class HapticsPlugin: Plugin { } @_cdecl("init_plugin_haptics") -func initPlugin() -> Plugin { +public func initPlugin() -> Plugin { return HapticsPlugin() } diff --git a/plugins/log/ios/Sources/LogPlugin.swift b/plugins/log/ios/Sources/LogPlugin.swift index d1ced2c90..3520c95e4 100644 --- a/plugins/log/ios/Sources/LogPlugin.swift +++ b/plugins/log/ios/Sources/LogPlugin.swift @@ -8,7 +8,7 @@ import UIKit import os.log @_cdecl("tauri_log") -func log(level: Int, message: NSString) { +public func log(level: Int, message: NSString) { switch level { case 1: Logger.debug(message as String) case 2: Logger.info(message as String) diff --git a/plugins/nfc/ios/Sources/NfcPlugin.swift b/plugins/nfc/ios/Sources/NfcPlugin.swift index af1a68d58..34af0c8f4 100644 --- a/plugins/nfc/ios/Sources/NfcPlugin.swift +++ b/plugins/nfc/ios/Sources/NfcPlugin.swift @@ -518,6 +518,6 @@ class NfcPlugin: Plugin, NFCTagReaderSessionDelegate, NFCNDEFReaderSessionDelega } @_cdecl("init_plugin_nfc") -func initPlugin() -> Plugin { +public func initPlugin() -> Plugin { return NfcPlugin() } diff --git a/plugins/notification/ios/Sources/NotificationPlugin.swift b/plugins/notification/ios/Sources/NotificationPlugin.swift index 8adbff9f5..c0300848f 100644 --- a/plugins/notification/ios/Sources/NotificationPlugin.swift +++ b/plugins/notification/ios/Sources/NotificationPlugin.swift @@ -285,6 +285,6 @@ class NotificationPlugin: Plugin { } @_cdecl("init_plugin_notification") -func initPlugin() -> Plugin { +public func initPlugin() -> Plugin { return NotificationPlugin() } diff --git a/plugins/opener/ios/Sources/OpenerPlugin.swift b/plugins/opener/ios/Sources/OpenerPlugin.swift index 2311a3b1b..1b561e90e 100644 --- a/plugins/opener/ios/Sources/OpenerPlugin.swift +++ b/plugins/opener/ios/Sources/OpenerPlugin.swift @@ -41,6 +41,6 @@ class OpenerPlugin: Plugin { } @_cdecl("init_plugin_opener") -func initPlugin() -> Plugin { +public func initPlugin() -> Plugin { return OpenerPlugin() } diff --git a/plugins/shell/ios/Sources/ShellPlugin.swift b/plugins/shell/ios/Sources/ShellPlugin.swift index 0fcb7dac1..ab6feb747 100644 --- a/plugins/shell/ios/Sources/ShellPlugin.swift +++ b/plugins/shell/ios/Sources/ShellPlugin.swift @@ -29,6 +29,6 @@ class ShellPlugin: Plugin { } @_cdecl("init_plugin_shell") -func initPlugin() -> Plugin { +public func initPlugin() -> Plugin { return ShellPlugin() }