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

objc-obsessive
  • 825
  • 1
  • 12
  • 18

1 Answers1

0

convert the UIImage to a NSData and then to a base64EncodedString. You will be able to use the same method to send the data across.

Only pitfall is if the sendMessage is a synchronous call, you might have to use GCD queues to send it asynchronously.

Mugunth
  • 14,461
  • 15
  • 66
  • 94
  • OK, thank you. Would you be able to post a mini example of how I convert it to a base64EncodedString to send it and then 'uncovert' it back again? – objc-obsessive Apr 25 '12 at 07:14