fix(ios): use correct class to call plugin command with throws (#6830)

This commit is contained in:
Lucas Fernandes Nogueira
2023-05-01 10:19:28 -07:00
committed by GitHub
parent edb16d13a5
commit bb2a8ccf13
2 changed files with 6 additions and 1 deletions

View File

@@ -0,0 +1,5 @@
---
"tauri": patch
---
Use actual iOS plugin instance to run command with `throws`.

View File

@@ -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)")