Page 1 of 1

Beware of Unity iOS stripping settings

Posted: 21 Mar 2012, 11:08
by ThomasLund
In my own next game we just had a issue with connecting to the SFS server.

In case anyone else runs into the same, here is the problem and solution.

Problem:
Our game uses our own turn-based framework that sits between the scripts in Unity and Unity+SFS. Its compiled out as separate DLL files, and its in here that we got all SFS code embedded.

So our game scripts -> framework dll -> SFS dll

When deploying the game to iOS and trying to connect we got this weird exception:

Code: Select all

[SFS - ERROR] TCPSocketLayer: General exception on connection: An exception was thrown by the type initializer for System.Net.Sockets.Socket   at System.Net.Sockets.TcpClient.Init (AddressFamily family) [0x00000] in <filename unknown>:0
  at System.Net.Sockets.TcpClient..ctor () [0x00000] in <filename unknown>:0
  at Sfs2X.Core.Sockets.TCPSocketLayer.ConnectThread () [0x00000] in <filename unknown>:0
On Connection callback got: False (error : <General exception on connection: An exception was thrown by the type initializer for System.Net.Sockets.Socket   at System.Net.Sockets.TcpClient.Init (AddressFamily family) [0x00000] in <filename unknown>:0
  at System.Net.Sockets.TcpClient..ctor () [0x00000] in <filename unknown>:0
  at Sfs2X.Core.Sockets.TCPSocketLayer.ConnectThread () [0x00000] in <filename unknown>:0 >)


It turns out that we had stripping set to "Strip Assemblies". Since the game code itself never used TCPClient, those classes got stripped out.

So in case you ever have this issue, then one solution is to set stripping to none. Alternatively you can start adding things to the link.xml file explained here:

http://unity3d.com/support/documentatio ... ation.html

Hopefully this saves someone half a day of debugging sometime

/Thomas

Re: Beware of Unity iOS stripping settings

Posted: 17 Jul 2013, 03:29
by bjsion
Hi Thomas,

Apologies for reviving an old thread, but my question really relates to this.

I am attempting to use the stripping option when compiling my Unity project for iOS. I am aware of the link.xml, but what I want to know is there if there is a list of dependency classes that are required by the SmartFox2(X).dll that should be included in this file?

Something like this would be very helpful.

Thanks in advance.

Cheers,
Ben

Re: Beware of Unity iOS stripping settings

Posted: 11 Dec 2014, 10:24
by Eser Telekom
Same Error occur in Android S4 . I fixed this problem with set to stripping level "Disabled".

Re: Beware of Unity iOS stripping settings

Posted: 11 Dec 2014, 18:30
by Lapo
Thanks for reporting.