0

I am integrating an iOS framework (Vidyo https://developer.vidyo.io/#/documentation/4.1.25.30) from a custom NativeScript plugin. I am able to instantiate iOS class from my plugin but I am not able to call properly this iOS function :

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

From the nativescript command

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

I am able to see the signature that NativeScript is waiting for :

- 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

When I give a void pointer it's working, however the function is waiting for a view to display a video so the function is doing its job but I see nothing on my iOS app. For now I have my UIView :

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

It does not works, as I have an error :

 ERROR Error: Value is not a pointer.

Question : How to get a pointer from my UIView ?

ValentinV
  • 764
  • 1
  • 8
  • 17
  • Which SDK / Framework you are actually trying to implement, do they have the docs for Objective C? – Manoj Mar 11 '19 at 19:43
  • @Manoj I'm trying to implement Vidyo developer.vidyo.io/#/documentation/4.1.25.30. They do have documentation in Objective C and a sample. They pass the UIView pointer. However I am not able to pass in the NativeScript UIView as a pointer to give it to Vidyo – ValentinV Mar 12 '19 at 09:49
  • Maybe you should look for `interop.Reference`: https://docs.nativescript.org/core-concepts/ios-runtime/types/C-Pointers – Juky Mar 12 '19 at 13:09
  • Hi @Juky thank you for your help, I already tried but I don't know what to give to interop.Reference() since every examples are for string / integer and not complex objects like UIView – ValentinV Mar 12 '19 at 13:31

1 Answers1

1

Finally found the solution, with some luck to be honest :

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

Quite straightforward but the documentation was not clear about it. Hope this helps

ValentinV
  • 764
  • 1
  • 8
  • 17