From bb2a8ccf1356e59b98947d827d61e4e99533f2bc Mon Sep 17 00:00:00 2001 From: Lucas Fernandes Nogueira Date: Mon, 1 May 2023 10:19:28 -0700 Subject: [PATCH] fix(ios): use correct class to call plugin command with `throws` (#6830) --- .changes/fix-ios-plugin-throws-command.md | 5 +++++ core/tauri/mobile/ios-api/Sources/Tauri/Tauri.swift | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) create mode 100644 .changes/fix-ios-plugin-throws-command.md diff --git a/.changes/fix-ios-plugin-throws-command.md b/.changes/fix-ios-plugin-throws-command.md new file mode 100644 index 00000000000..97c74bf53a0 --- /dev/null +++ b/.changes/fix-ios-plugin-throws-command.md @@ -0,0 +1,5 @@ +--- +"tauri": patch +--- + +Use actual iOS plugin instance to run command with `throws`. diff --git a/core/tauri/mobile/ios-api/Sources/Tauri/Tauri.swift b/core/tauri/mobile/ios-api/Sources/Tauri/Tauri.swift index a9e3a9928b7..330a3974105 100644 --- a/core/tauri/mobile/ios-api/Sources/Tauri/Tauri.swift +++ b/core/tauri/mobile/ios-api/Sources/Tauri/Tauri.swift @@ -64,7 +64,7 @@ public class PluginManager { var error: NSError? = nil withUnsafeMutablePointer(to: &error) { let methodIMP: IMP! = plugin.instance.method(for: selectorWithThrows) - unsafeBitCast(methodIMP, to: (@convention(c)(Any?, Selector, Invoke, OpaquePointer) -> Void).self)(plugin, selectorWithThrows, invoke, OpaquePointer($0)) + unsafeBitCast(methodIMP, to: (@convention(c)(Any?, Selector, Invoke, OpaquePointer) -> Void).self)(plugin.instance, selectorWithThrows, invoke, OpaquePointer($0)) } if let error = error { invoke.reject("\(error)")