ios - Thread 1 : EXC_BAD_ACCESS (Code = 1, address = 0x0) issue generated -
i using paho mqtt (internet of things) mobilefirst 7.1 hybrid application development (for ios ,android , windows phone devices). tried 'broker.mqttdashboard.com' mqtt broker, not working ios .
error:
xcode console:
libc++abi.dylib: pure virtual function called!
main.js:
function wlcommoninit(){ mqttconnect(); //connect broker subscribe }
mqttservice.js:
var host = 'broker.mqttdashboard.com'; var port = 8000; var topic = 'sensor'; // topic subscribe var usetls = false; var username = null; var password = null; // username = "nazmul"; // password = "kp0582!"; var cleansession = true; var mqtt; var reconnecttimeout = 2000; function mqttconnect() { mqtt = new paho.mqtt.client( host, port, "web_" + parseint(math.random() * 100, 10)); var options = { timeout: 3, usessl: usetls, cleansession: cleansession, onsuccess: onconnect, onfailure: function (message) { console.log("connection failed: " + message.errormessage + "retrying") settimeout(mqttconnect, reconnecttimeout); } }; mqtt.onconnectionlost = onconnectionlost; mqtt.onmessagearrived = onmessagearrived; if (username != null) { options.username = username; options.password = password; } console.log("host="+ host + ", port=" + port + " tls = " + usetls + " username=" + username + " password=" + password); mqtt.connect(options); }; function onconnect() { console.log('connected ' + host + ':' + port) // connection succeeded; subscribe our topic mqtt.subscribe(topic, {qos: 0}); }; function onconnectionlost(response) { settimeout(mqttconnect, reconnecttimeout); console.log("connection lost: " + responseobject.errormessage + ". reconnecting") }; function onmessagearrived(message) { var topic = message.destinationname; var payload = message.payloadstring; console.log( topic + ' = ' + payload) alert(topic + ' = ' + payload); };
mobilefirst: version 7.1.0.00-20151114-1616
xcode: version 7.2 beta (7c46t)
iphone 6s plus
project uploaded here: https://github.com/nazmulkp/mqtt-mobilefirst-hybrid-application
thank you
int retval = uiapplicationmain(argc, argv, nil, nsstringfromclass([appdelegate class])); return retval;
Comments
Post a Comment