triniwiz / nativescript-socketio

Socket.IO for nativescript
Apache License 2.0
71 stars 31 forks source link

Error in main file #2

Closed Koronos closed 8 years ago

Koronos commented 8 years ago

Hi Mr. Osei,

I'm trying use the plugin in a project, but get this message when i try compile the app.

java.lang.RuntimeException: Unable to start activity ComponentInfo{org.nativescript.chat/com.tns.NativeScriptActivity}: com.tns.NativeScriptException: Calling js method onCreate failed

ReferenceError: io is not defined File: ", line: 1, column: 265

StackTrace: Frame: function:'', file:'/data/data/org.nativescript.chat/files/app/tns_modules/nativescript-socketio/socketio.js', line: 9, column: 15 Frame: function:'require', file:'', line: 1, column: 266 Frame: function:'', file:'/data/data/org.nativescript.chat/files/app/pages/inicio/main-page.js', line: 1, column: 76 Frame: function:'require', file:'', line: 1, column: 266 Frame: function:'global.loadModule', file:'/data/data/org.nativescript.chat/files/app/tns_modules/globals/globals.js', line: 19, column: 16 Frame: function:'resolvePageFromEntry', file:'/data/data/org.nativescript.chat/files/app/tns_modules/ui/frame/frame-common.js', line: 72, column: 40 Frame: function:'Frame.navigate', file:'/data/data/org.nativescript.chat/files/app/tn

So check the plugin code and actually I did not find where it is called the "io" object in the main files

import common = require('./socketio.common'); import jsonHelper = require('./helpers/jsonHelper'); import app = require("application"); const Emitter = io.socket.emitter.Emitter; //When is io called? D: const IO = io.socket.client.IO; const Socket = io.socket.client.Socket; const Ack = io.socket.client.Ack;

I don't know if is my mistake, honestly do not know much about how it works nativescript , but I can not make the library work.

Thanks in advance.

PD: Sorry for my pretty ugly english.

Koronos commented 8 years ago

I found the problem,

I'm not sure why, but when is added a plugin when livesync is on, this doesn't load correctly the plugin, is nesessary compilate all solution again.

Sorry for the issue.