triniwiz / nativescript-socketio

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

emitWithItems is undefined #32

Closed c1tt1 closed 7 years ago

c1tt1 commented 7 years ago

There seem to an issue the socket.ios.ts, I keep getting this error TypeError: this.socket.emitWithItems is not a function. (In 'this.socket.emitWithItems(event, payload)', 'this.socket.emitWithItems' is undefined).

After stepping through debugging the code it takes to the this.socket.emitWithItems(event, payload); inside the socket.ios.ts file which logs the above message.

I then added at the following to my Podfile but still have the same issue.

target "app" do
# Begin Podfile - /Users/tviel/Projects/pursUe/app/node_modules/nativescript-google-maps-sdk/platforms/ios/Podfile 
 pod 'GoogleMaps' 
 # End Podfile 
# Begin Podfile - /Users/tviel/Projects/pursUe/app/node_modules/nativescript-socketio/platforms/ios/Podfile 
 #pod 'Socket.IO-Client-Swift', :git => 'https://github.com/socketio/socket.io-client-swift.git'
 pod 'Socket.IO-Client-Swift', :git => 'https://github.com/socketio/socket.io-client-swift.git', :branch => 'swift2.3'

 # End Podfile 

end

post_install do |installer|
  installer.pods_project.targets.each do |target|
    target.build_configurations.each do |config|
      config.build_settings['SWIFT_VERSION'] = '2.3'
    end
  end
end
nalinimanduva commented 7 years ago

I'm also getting the same error while running the demo app file:///app/tns_modules/nativescript-socketio/socketio.js:81:38: JS ERROR TypeError: this.socket.emitWithItems is not a function. (In 'this.socket.emitWithItems(event, payload)', 'this.socket.emitWithItems' is undefined)

Please help.

c1tt1 commented 7 years ago

@nalinimanduva add this to your podfile and pod install maybe that would help

target "app" do
# Begin Podfile - /Users/tviel/Projects/pursUe/app/node_modules/nativescript-google-maps-sdk/platforms/ios/Podfile 
 pod 'GoogleMaps' 
 # End Podfile 
# Begin Podfile - /Users/tviel/Projects/pursUe/app/node_modules/nativescript-socketio/platforms/ios/Podfile 
 #pod 'Socket.IO-Client-Swift', :git => 'https://github.com/socketio/socket.io-client-swift.git'
 pod 'Socket.IO-Client-Swift', :git => 'https://github.com/socketio/socket.io-client-swift.git', :branch => 'swift2.3'

 # End Podfile 

end

post_install do |installer|
  installer.pods_project.targets.each do |target|
    target.build_configurations.each do |config|
      config.build_settings['SWIFT_VERSION'] = '2.3'
    end
  end
end
triniwiz commented 7 years ago

@per19 i think everything should be working with the latest update

roblav96 commented 7 years ago

@per19 @triniwiz i reverted the pod version back. it works

c1tt1 commented 7 years ago

@triniwiz @roblav96 for some when I updated it idid not work for me. I had to update the pod script with the above.

roblav96 commented 7 years ago

@per19 I'll have to double check their source code. This might have been a mistake by me :X

triniwiz commented 7 years ago

@roblav96 the method changed i started to do some updates but they were failing with the ack method but they where changed to => emitWithAckWith(event, payload).timingOutAfterCallback() & emitWith(event, payload)

ngunhaSO commented 6 years ago

I am having this issue, I have just started using it today. On my package.json, the version is: "nativescript-socketio": "^2.4.0" The code that cause the issue is: this.socket.emit('getAllRooms', userid);