Search code examples
cordovaopentok

blocked in opentok troubleshoot guide Apple Mach-O Linker Errors


i'm trying to create a one to one video call app and i hope opentok is the right way to do that.

I had tried to run a simple helloworld opentok app following the step to step instruction in github but i'm blocked to the four errors described in the faq troubleshoot guide. I've change Build Active Architecture Only' to NO and i've remove armv7s and arm64 from Valid Architectures. I've insert my id, key and token in index.js but the problem doesn't change... I think which the solution is relatively simple but i don't know it... this is my code index.js

var apiKey = "xxx";
var sid = "xxx";
var token = "xxx";
var app = {
    // Application Constructor
initialize: function() {
    this.bindEvents();
},

    // Bind Event Listeners
    //
    // Bind any events that are required on startup. Common events are:
    // 'load', 'deviceready', 'offline', and 'online'.
bindEvents: function() {
    document.addEventListener('deviceready', this.onDeviceReady, false);
},
    // deviceready Event Handler
    //
    // The scope of 'this' is the event. In order to call the 'receivedEvent'
    // function, we must explicity call 'app.receivedEvent(...);'
onDeviceReady: function() {

    // Getting OpenTokRTC's room's credentials.
    // To use your own room in opentokrtc, change cordova to room of your choice
    //   -> ie: https://opentokrtc.com/myroom.json
    // To use your own credentials
    //  replace data.apiKey, data.sid, and data.token with your own
    var xmlhttp=new XMLHttpRequest();
    xmlhttp.open("GET", "https://opentokrtc.com/test.json", false);
    xmlhttp.send();
    var data = JSON.parse( xmlhttp.response );

    // Very simple OpenTok Code for group video chat
    var publisher = TB.initPublisher(apiKey,'myPublisherDiv');

    var session = TB.initSession( apiKey, sid );
    session.on({
           'streamCreated': function( event ){
           var div = document.createElement('div');
           div.setAttribute('id', 'stream' + event.stream.streamId);
           document.body.appendChild(div);
           session.subscribe( event.stream, div.id, {subscribeToAudio: false} );
           }
           });
    session.connect(token, function(){
                session.publish( publisher );
                });

},
    // Update DOM on a Received Event
receivedEvent: function(id) {
}
};

I also have create a test chat page at https://opentokrtc.com/ and insert test.json in the javascript file but nothing change...

I really would like to subscribe a plan and build this app. Thanks in advance


Solution

  • There is no iOS emulator support currently because OpenTok depends on hardware encoding/decoding of video streams and needs to access the camera. Linker errors is probably caused by trying to deploy to simulator, it should be fixed if you deploy to device. If you are still experiencing issues, please post the linker errors as well.