Skip to content

Commit

Permalink
fix(ios): use correct class to call plugin command with throws (#6830)
Browse files Browse the repository at this point in the history
  • Loading branch information
lucasfernog committed May 1, 2023
1 parent edb16d1 commit bb2a8cc
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
5 changes: 5 additions & 0 deletions .changes/fix-ios-plugin-throws-command.md
@@ -0,0 +1,5 @@
---
"tauri": patch
---

Use actual iOS plugin instance to run command with `throws`.
2 changes: 1 addition & 1 deletion core/tauri/mobile/ios-api/Sources/Tauri/Tauri.swift
Expand Up @@ -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)")
Expand Down

0 comments on commit bb2a8cc

Please sign in to comment.