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

How to get a pointer from my NativeScript UIView for iOS?

我正在集成来自自定义 NativeScript 插件的 iOS 框架 (Vidyo https://developer.vidyo.io/#/documentation/4.1.25.30)。我可以从我的插件实例化 iOS class 但我无法正确调用此 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

当我给出一个空指针时,它正在工作,但是该函数正在等待一个视图来显示视频,因此该函数正在执行它的工作,但我在我的 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, [...])

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