将图像传输到iphone http

将图像传输到iphone http,iphone,objective-c,data-transfer,Iphone,Objective C,Data Transfer,我已经建立了与服务器的连接,现在我想将图像传输到iPhone。最好的方法是什么?我检查了一下,除了xml之外,我看不到任何传输方法。我需要图像。谢谢大家! 下面是一个将图像从web传输到iphone的示例: id path = @"http://a1.twimg.com/profile_images/65821548/summer2007_normal.jpg"; NSURL *url = [NSURL URLWithString:path]; N

我已经建立了与服务器的连接,现在我想将图像传输到iPhone。最好的方法是什么?我检查了一下,除了xml之外,我看不到任何传输方法。我需要图像。谢谢大家!

下面是一个将图像从web传输到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 ];

下面是一个将图像从web传输到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 ];

有人举过使用nsurlconnection的例子吗?这是最好的方法还是其他更好的方法?布莱恩:图像来自哪里?你想在手机上的什么地方使用/保存它?它来自一个web服务器,我发送了一个http帖子,然后收到一条包含xml、文件信息、二进制文件的MIME消息。有人举过使用nsurlconnection的例子吗?这是最好的方法还是其他更好的方法?布莱恩:图像来自哪里?你想在手机上的什么地方使用/保存它?它来自一个web服务器,我发送了一个http帖子,然后收到一条包含xml、文件信息和二进制文件的MIME消息。