UnitySocketIO cant receive/emit packet in iOS

i’m developing apps using Netease UnitySocketIO and implementing server using NodeJS
everything works well in UnityEditor and in Android

but when i build the apps to my iPad Air, i cannot receive/emit any packets from/to my server (btw, the log shows that the socket is connected and the server’s log shows that it’s connected).

is there any problems about SocketIO with iOS?

any solutions would be appreciated
Thank you so much :slight_smile:

I guess you should start looking for errors in Xcode debugger console.

it has some warnings about SocketIO saying ‘bad access’.
clicking it will result in showing some assembly code.

here is the picture of my xcode project when built

update: i tried printing the ‘raw message’ that the socket got (by digging into the api class and insert Debug.log in the method that gets the raw message)
the raw message can be printed successfully (something like: { “name”:“login”, “args”:{}} )

but the message is not go into the event i registered.

We have dedicated troubleshooting section in iOS manual, which is worth reading before digging deeper: Unity - Manual: Troubleshooting.

My short advice would be:

  1. collect all stack traces with lldb command: bt all
  2. unfortunately it seems in your case Xcode is picking short translated function name instead of long one, which makes stack trace analysis bit more complicated
  3. you still can click on different stack frames in left Xcode panel, and scroll to the beginning of disassembled function, you should find there C style name of the function, which could give a clue, which exactly C# function is crashing.

If you are on iOS Pro, it might be worth to try script debugging feature, which should stop debugger at the place where crash is happening.

thanks for the reply :slight_smile:

i think i found the problem
Netease uses the class SimpleJson to deserialize and serialize all of its Json formats.
I try change the SimpleJson to JSON with some modification in original Netease’s code, and I can emit/receive events!

some more questions: I have no idea why SimpleJson can not be used in iOS? I’m planning to use XmlSerializer in the future, is it gonna be a problem too?

Thank you very much for your help :smile:

Unity is compiling .NET bytecode to ARM ahead of time (not JIT), which causes major troubles when used in combination of generics and reflection. And typically universal deserializers rely on reflection… Though not sure if that’s exactly what is causing troubles in your case, as usually people receive different kind of exceptions in such cases. There are only few JSON and Xml parsers that work well on iOS, so my advice would be try it in smaller project before deploying it to your final project, also its worth looking forums for compatibility issues.

I see.
btw, Thanks so much for your help :slight_smile: