ios - 如何从我的 NativeScript UIView for iOS 中获取指针?
问题描述
我正在从自定义 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
当我给出一个 void 指针时它正在工作,但是该函数正在等待视图显示视频,因此该函数正在完成它的工作,但我在我的 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, [...])
很简单,但文档并不清楚。希望这可以帮助
推荐阅读
- sql - 如何在 PostgreSQL 中使用单个 SQL 命令仅转换表的一部分
- flutter - 如何从路线类列表中生成路线图
- c++ - C++中的库链接,三个库之间的依赖关系
- java - EhCache 3.8.1 引导缓存加载器
- java - 如何从 FirebaseDatabase 检索日期并计算自存储数据以来的分钟/小时/天?
- javascript - 图像不显示在 VueJS 的组件中
- javascript - 显示图像的原始二进制数据
- javascript - ArcGIS JavaScipt API;检查当前可见的旧范围是否在新范围中
- react-native - FontFamily "Material Design Icons" 不是系统字体,没有通过 Font.loadAsync 加载
- tinymce - TinyMCE HTML 编辑器禁用图像插入源文本框