gpt4 book ai didi

ios - 如何从我的 iOS NativeScript UIView 获取指针?

转载 作者:行者123 更新时间:2023-11-28 23:35:24 38 4
gpt4 key购买 nike

我正在从自定义 NativeScript 插件集成 iOS 框架 (Vidyo https://developer.vidyo.io/#/documentation/4.1.25.30 )。我可以从我的插件实例化 iOS 类,但无法正确调用此 iOS 函数:

(id) init:(void*)view RemoteParticipants:(unsigned int)remoteParticipants LogFileFilter:(const char*)logFileFilter LogFileName:(const char*)logFileName

来自 nativescript 命令

TNS_DEBUG_METADATA_PATH="$(pwd)/metadata" tns build ios

我能够看到 NativeScript 正在等待的签名:

- Name:            'init:ViewStyle:RemoteParticipants:LogFileFilter:LogFileName:'
JsName: initViewStyleRemoteParticipantsLogFileFilterLogFileName
Filename: [...].h
Module:
[...]
Type: Method
Signature:
- Type: Instancetype
- Type: Pointer
PointerType:
Type: Void
- Type: Enum
Name: VCConnectorViewStyle
- Type: UInt
- Type: CString
- Type: CString

当我给出一个空指针时,它正在工作,但是该函数正在等待 View 来显示视频,因此该函数正在执行其工作,但我在我的 iOS 应用程序上看不到任何内容。现在我有我的 UIView :

this.nativeView = UIView.alloc().initWithFrame(UIScreen.mainScreen.bounds)
initViewStyleRemoteParticipantsLogFileFilterLogFileName(this.nativeView, [...])

它不起作用,因为我有一个错误:

 ERROR Error: Value is not a pointer.

问题:如何从我的 UIView 获取指针?

最佳答案

终于找到了解决方案,老实说,运气不错:

this.nativeView = UIView.alloc().initWithFrame(UIScreen.mainScreen.bounds)
let ref = new interop.Reference(interop.Pointer, this.nativeView)
initViewStyleRemoteParticipantsLogFileFilterLogFileName(ref, [...])

非常简单,但文档对此并不清楚。希望这有帮助

关于ios - 如何从我的 iOS NativeScript UIView 获取指针?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/55105144/

38 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com