0

The plugin in question is: https://github.com/sean-perkins/nativescript-opentok/tree/delegate-exploration. If you npm install and set the build version to 1.4.4 you will get the up-to-date test version for this bug.

The plugin experiences two issues:

  1. At first, the new constructor declaration style for {N} is not recognized, so I have to fall-back to the old-school Class.alloc().initWith declaration style. I believe this may actually be related to #2.

  2. Upon updating the constructor, the same line of code will fail with: [__NSCFNumber length]: unrecognized selector sent to instance 0xb00000002b879aa2.

The code in question is:

public static initWithApiKeySessionIdToken(apiKey: string, sessionId: string, token:string): TNSOTSession {
        let instance = <TNSOTSession>TNSOTSession.new();
        instance.events = new Observable();
        instance.session = OTSession.alloc().initWithApiKeySessionIdDelegate(apiKey, sessionId, instance);
        let errorRef = new interop.Reference();
        instance.session.connectWithTokenError(token, errorRef);
        if(errorRef.value) {
            console.log(errorRef.value);
        }
        return instance;
    }

The class (TNSOTSession) extends NSObject and implements the protocol for OTSessionDelegate, which should maintain the selector instances, as per {N} docs:

"Methods that are overridden will infer their signatures from the base class or protocols they implement."

Ref: https://docs.nativescript.org/runtimes/ios/how-to/ObjC-Subclassing

If you need to view the iOS API documentation for OpenTok, please refer to: https://www.tokbox.com/developer/sdks/ios/reference/Classes/OTSession.html.

Thank you to anyone that can help me move forward on this issue. The demo works perfectly. The issue is found in a {N} + Angular 2 test project.

1 Answer 1

1

For anyone that runs into this issue, be sure that if your plugin has a numeric API key or any value for that matter, that is expected to be a string... be sure to cast it as a string with .toString(). My whole issue was focused around that one small minor detail.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.