[INFSmartFoxiPhoneClientAPI_2X] Crash on decodeSFSObject
Posted: 15 Feb 2011, 07:44
Hi,
I'm realizing a service with SmartFoxServer 2X, my server is ok, my extension too and my Flash client to, but not my iPhone client !
All connections are okay, but not a return of my extension ! this extension works with my Flash Client, but not with my iPhone Client. I have got an error when my app has a result :
*** Terminating app due to uncaught exception 'SFSCodecException', reason: 'Invalid SFSDataType. Expected: 18, found: 120'
*** Call stack at first throw:
(
0 CoreFoundation 0x0155fbe9 __exceptionPreprocess + 185
1 libobjc.A.dylib 0x016b45c2 objc_exception_throw + 47
2 LionCereales 0x0006d983 -[DefaultSFSDataSerializer decodeSFSObject:] + 202
3 LionCereales 0x0006f7fa -[DefaultSFSDataSerializer binary2object:] + 222
4 LionCereales 0x0005f1ba +[SFSObject newFromBinaryData:] + 72
5 LionCereales 0x000597ed -[SFSProtocolCodec onPacketRead:] + 50
6 LionCereales 0x00058051 -[SFSIOHandler handlePacketData:] + 781
7 LionCereales 0x00058dc5 -[SFSIOHandler onDataRead:] + 558
8 LionCereales 0x0004b44b -[BitSwarmClient stream:handleEvent:] + 1753
9 CoreFoundation 0x0153b1d2 _inputStreamCallbackFunc + 82
With this trace and the XCode debugger, i found where is a problem : in the function -(id <ISFSObject>)decodeSFSObject:(Data *)buffer.
In this function, the exception has thrown here :
id <ISFSObject> sfsObject = [SFSObject newInstance];
int8_t headerByte = [buffer readByte];
if (headerByte != SFSDataType_SFS_OBJECT) {
@throw [SFSCodecException exceptionWithReason:[NSString stringWithFormat:@"Invalid SFSDataType. Expected: %d, found: %d", SFSDataType_SFS_OBJECT, headerByte]];
}
Like my packet is not an SFSDataType_SFS_OBJECT !
But it's the same packet return in my Flash Client ! but why my iPhone Client crash, and not my Flash Client ???
Can you help me ?
Thank you
Guillaume
I'm realizing a service with SmartFoxServer 2X, my server is ok, my extension too and my Flash client to, but not my iPhone client !
All connections are okay, but not a return of my extension ! this extension works with my Flash Client, but not with my iPhone Client. I have got an error when my app has a result :
*** Terminating app due to uncaught exception 'SFSCodecException', reason: 'Invalid SFSDataType. Expected: 18, found: 120'
*** Call stack at first throw:
(
0 CoreFoundation 0x0155fbe9 __exceptionPreprocess + 185
1 libobjc.A.dylib 0x016b45c2 objc_exception_throw + 47
2 LionCereales 0x0006d983 -[DefaultSFSDataSerializer decodeSFSObject:] + 202
3 LionCereales 0x0006f7fa -[DefaultSFSDataSerializer binary2object:] + 222
4 LionCereales 0x0005f1ba +[SFSObject newFromBinaryData:] + 72
5 LionCereales 0x000597ed -[SFSProtocolCodec onPacketRead:] + 50
6 LionCereales 0x00058051 -[SFSIOHandler handlePacketData:] + 781
7 LionCereales 0x00058dc5 -[SFSIOHandler onDataRead:] + 558
8 LionCereales 0x0004b44b -[BitSwarmClient stream:handleEvent:] + 1753
9 CoreFoundation 0x0153b1d2 _inputStreamCallbackFunc + 82
With this trace and the XCode debugger, i found where is a problem : in the function -(id <ISFSObject>)decodeSFSObject:(Data *)buffer.
In this function, the exception has thrown here :
id <ISFSObject> sfsObject = [SFSObject newInstance];
int8_t headerByte = [buffer readByte];
if (headerByte != SFSDataType_SFS_OBJECT) {
@throw [SFSCodecException exceptionWithReason:[NSString stringWithFormat:@"Invalid SFSDataType. Expected: %d, found: %d", SFSDataType_SFS_OBJECT, headerByte]];
}
Like my packet is not an SFSDataType_SFS_OBJECT !
But it's the same packet return in my Flash Client ! but why my iPhone Client crash, and not my Flash Client ???
Can you help me ?
Thank you
Guillaume