0

I have been using these projects files (SuperChat), to try and set up a kind of messaging app. I have done this and it successfully works but I need to be able to send images across the two devices now.

I use this code to send a message to the other device:

[theTopic publishMessage:@"Message"];

How would I be able to send an image, as this only let's you send an NSString.

Help would be greatly appreciated!

Thanks

4

1 に答える 1

0

UIImage を NSData に変換してから、base64EncodedString に変換します。同じ方法でデータを送信できます。

唯一の落とし穴は、sendMessage が同期呼び出しである場合です。GCD キューを使用して非同期に送信する必要がある場合があります。

于 2012-04-25T06:14:06.143 に答える