浏览代码

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

Lucas Fernandes Nogueira 2 年之前
父节点
当前提交
bb2a8ccf13
共有 2 个文件被更改,包括 6 次插入1 次删除
  1. 5 0
      .changes/fix-ios-plugin-throws-command.md
  2. 1 1
      core/tauri/mobile/ios-api/Sources/Tauri/Tauri.swift

+ 5 - 0
.changes/fix-ios-plugin-throws-command.md

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

+ 1 - 1
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)")