1

I have setup a connection to a server and now I want to transfer images to the iPhone. What's the best way to do this? I checked here and I don't see a way to transfer anything other than xml. I need images. Thank You!

Community
  • 1
  • 1
Bryan Cimo
  • 1,268
  • 1
  • 19
  • 34
  • Does anyone have an example of this using nsurlconnection and is that the best way, or is something else better? – Bryan Cimo Sep 09 '09 at 02:09
  • Bryan: Where is the image coming from? Where do you want to use/save it on the phone? – JWD Sep 09 '09 at 13:38
  • It's coming from a web server, I send a http post and get back a MIME message with xml, file info, binaries. – Bryan Cimo Sep 10 '09 at 21:43

1 Answers1

6

Here's an example of transfering images from the web to the iphone:

id path = @"http://a1.twimg.com/profile_images/65821548/summer2007_normal.jpg";
            NSURL *url = [NSURL URLWithString:path];
            NSData *data = [NSData dataWithContentsOfURL:url];
            UIImage *img = [[UIImage alloc] initWithData:data ];
ennuikiller
  • 46,381
  • 14
  • 112
  • 137