Page 2 of 3

Posted: 01 Feb 2011, 08:12
by Lapo
We have a new update addressing this issue here ->

Posted: 09 Feb 2011, 11:54
by geraldyeo
Hi, I'm still having issues after using the new release.

I'm trying to send over a byte array of an image from Flash over SFS to iOS to display.

I've tested it with a Flash client and it correctly renders the image. It crashes in iOS.

Code: Select all

[Session started at 2011-02-09 21:09:46 +0800.]
2011-02-09 21:09:51.926 SFSwebcam[12021:207] connection success
2011-02-09 21:09:51.943 SFSwebcam[12021:207] ROOM JOINED
2011-02-09 21:09:51.958 SFSwebcam[12021:207] *** Terminating app due to uncaught exception 'SFSCodecException', reason: 'Invalid SFSDataType. Expected: 18, found: 120'
*** Call stack at first throw:
   0   CoreFoundation                      0x01142be9 __exceptionPreprocess + 185
   1   libobjc.A.dylib                     0x012975c2 objc_exception_throw + 47
   2   SFSwebcam                           0x0000e1b7 -[DefaultSFSDataSerializer decodeSFSObject:] + 202
   3   SFSwebcam                           0x0001002e -[DefaultSFSDataSerializer binary2object:] + 222
   4   SFSwebcam                           0x00024832 +[SFSObject newFromBinaryData:] + 72
   5   SFSwebcam                           0x00026bdd -[SFSProtocolCodec onPacketRead:] + 50
   6   SFSwebcam                           0x000232f7 -[SFSIOHandler handlePacketData:] + 781
   7   SFSwebcam                           0x0002406b -[SFSIOHandler onDataRead:] + 558
   8   SFSwebcam                           0x0000668f -[BitSwarmClient stream:handleEvent:] + 1753
   9   CoreFoundation                      0x0111e1d2 _inputStreamCallbackFunc + 82
   10  CoreFoundation                      0x010f2093 _signalEventSync + 99
   11  CoreFoundation                      0x010f1ffe _cfstream_shared_signalEventSync + 334
   12  CoreFoundation                      0x0112401f __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 15
   13  CoreFoundation                      0x0108228b __CFRunLoopDoSources0 + 571
   14  CoreFoundation                      0x01081786 __CFRunLoopRun + 470
   15  CoreFoundation                      0x01081240 CFRunLoopRunSpecific + 208
   16  CoreFoundation                      0x01081161 CFRunLoopRunInMode + 97
   17  GraphicsServices                    0x0178f268 GSEventRunModal + 217
   18  GraphicsServices                    0x0178f32d GSEventRun + 115
   19  UIKit                               0x0049642e UIApplicationMain + 1160
   20  SFSwebcam                           0x000028bc main + 102
   21  SFSwebcam                           0x0000284d start + 53
terminate called after throwing an instance of 'SFSCodecException'

Posted: 09 Feb 2011, 14:53
by Lapo
can you send us that same test image, so that we can test?
post a link to it if it's not too big

Posted: 10 Feb 2011, 03:45
by geraldyeo
Sure, here it is:

I've given the link to an experiment I was trying out: To send a series of images to the iPhone. This one is an initial test of sending bytearray between 2 flash instances.

Posted: 12 Feb 2011, 10:43
by Lapo
Thanks, we'll check it out asap

Posted: 18 Feb 2011, 13:39
by cemuzunlar
Hi geraldyeo,

We tested 100 K, 1 MB, 4 MB, 5 MB, 9 MB image files send from iPhone to Server, Server to iPhone, both with simulator and with device. We displayed the images send from the Server in he iPhone; Calculated the MD5 both on Server and on iPhone. No problem or crash happened during those tests.

Please make sure that

You are using the latest fixed API ( ...
If it is the correct API, lines 82:85 should be:

Code: Select all

//handle Compression
if (_pendingPacket.header.compressed) {
    _pendingPacket.buffer =
           [NSMutableData dataWithData:[_pendingPacket.buffer zlibInflate]];

if you are the latest API but still having problems, please send me the:

1) Your server source code
2) Your iPhone XCode project
3) Used test files etc.
4) Your SFS2X version.


Posted: 21 Feb 2011, 08:10
by geraldyeo
Hi cemuzunlar,

I'm using the latest update. Maybe I'm doing something wrong somewhere. I'll send over the files so that you can have a look.


Posted: 22 Feb 2011, 03:14
by geraldyeo
Hi cemuzunlar,

1) Not using custom server source code, using the game room functionality
2) Flash & iOS source <>
3) No test files, using webcam stream from Flash client
4) 2.0.0-RC1b

Let me know where I'm going wrong, and I'll try to fix it.


Posted: 22 Feb 2011, 15:23
by Lapo

Code: Select all

3) No test files, using webcam stream from Flash client

I don't know if it makes much sense. SFS is not meant for streaming, but anyways in theory it should work, I agree although the final result might be not so good.
Out of curiosity... do you decode the Flash video on the iphone at runtime?

Posted: 23 Feb 2011, 08:44
by geraldyeo
Hi Lapo,

I know SFS is not meant for streaming, but I want to do a proof of concept on the possibilities. I'm aware that the quality may not be good.

Yes, I'm thinking of decoding the images at runtime on the iPhone. However, in the source files i sent i've not reach that stage yet, because iPhone sim is crashing on me.

Posted: 23 Feb 2011, 09:03
by cemuzunlar
geraldyeo, we are currently checking the example source you've sent. Thanks.

Posted: 23 Feb 2011, 11:14
by cemuzunlar
We checked your sources. We are pretty sure that you are somehow using the old API.

Because, there is no -lz flag in your Other Linked Flags, and if you were using the new API, you couldn't compile your project successfully without adding it.

So please search and remove all files related to the old SFS2X iPhone API, then download and install the new SFS2X iPhone API and make sure that your project is actually using those files.

Posted: 01 Mar 2011, 02:51
by geraldyeo
Hi cemuzunlar,

I've removed and re-added the SFS2x and TouchXML folder to my project, and added -lxml2 -lz to Other Linker Flags.

It seems that I need to build with Release, because it doesn't crash. Maybe that's what's needed?

Also, in my viewcontroller I've the <ISFSEvents> so that I can capture the objectMessage events " - (void)onObjectMessage:(SFSEvent *)evt", but it isn't triggering. I couldn't find an example in your help documents, so if you could let me know if there is one or if I did something wrongly?


Posted: 01 Mar 2011, 06:30
by geraldyeo
Well, I sort of got it working now. I can see the B64 strings being passed. I'll carry on my experiment and post my findings.

Thanks for all your help guys!

Posted: 01 Mar 2011, 06:54
by cemuzunlar