Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Promise<ArrayBuffer> breaks on iOS #329

Closed
3 of 5 tasks
grabbou opened this issue Nov 13, 2024 · 3 comments · Fixed by #330
Closed
3 of 5 tasks

Promise<ArrayBuffer> breaks on iOS #329

grabbou opened this issue Nov 13, 2024 · 3 comments · Fixed by #330
Labels
nitro-core Issue is related to the Nitro Modules core runtime/C++ codebase

Comments

@grabbou
Copy link
Contributor

grabbou commented Nov 13, 2024

What's happening?

Reproduceable Code

Typescript:

type A : HybridObject<{ iOS: "swift" }> {
  callMe(): Promise<ArrayBuffer>
}

Cpp
```cpp
  // Methods
  @inline(__always)
  public func read() -> bridge.PromiseHolder_std__shared_ptr_ArrayBuffer__ {
    do {
      let __result = try self.__implementation.read()
      return { () -> bridge.PromiseHolder_std__shared_ptr_ArrayBuffer__ in
        let __promiseHolder = bridge.create_PromiseHolder_std__shared_ptr_ArrayBuffer__()
        __result
          .then({ __result in __promiseHolder.resolve(__result) })
          .catch({ __error in __promiseHolder.reject(std.string(String(describing: __error))) })
        return __promiseHolder
      }()
    } catch {
      let __message = "\(error.localizedDescription)"
      fatalError("Swift errors can currently not be propagated to C++! See https://github.com/swiftlang/swift/issues/75290 (Error: \(__message))")
    }
  }


### Relevant log output

```shell
> Cannot convert value of type 'ArrayBufferHolder' (aka 'margelo.nitro.ArrayBufferHolder') to expected argument type 'std.__1.shared_ptr<ArrayBuffer>'

Device

Any

Nitro Modules Version

0.15.0

Nitrogen Version

0.15.0

Can you reproduce this issue in the Nitro Example app here?

I didn't try (⚠️ your issue might get ignored & closed if you don't try this)

Additional information

@grabbou grabbou added the nitro-core Issue is related to the Nitro Modules core runtime/C++ codebase label Nov 13, 2024
@grabbou
Copy link
Contributor Author

grabbou commented Nov 13, 2024

Here's a quick-fix in source

CleanShot 2024-11-13 at 12 26 32@2x

@mrousavy
Copy link
Owner

fix: #330

@mrousavy
Copy link
Owner

Released in 0.16.2

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
nitro-core Issue is related to the Nitro Modules core runtime/C++ codebase
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants