通过webservice下载图像

时间:2011-04-26 16:11:20

标签: iphone asp.net objective-c web-services

你好 我有一个从.net webservice下载数据的iPhone应用程序。 Web服务使用以下内容: -

[System.Web.Script.Services.ScriptService] public class DownloadHelperService:System.Web.Services.WebService {

public DownloadHelperService () {

    //Uncomment the following line if using designed components 
    //InitializeComponent(); 
}
[WebMethod]
[System.Web.Script.Services.ScriptMethod(UseHttpGet = false)]
public byte[] Download(string fileName)
{
    return Facade.IOHelper.DownloadFileFromServer(fileName);
}

}

理论上,此方法将图像文件下载到客户端。问题是这是以Json的形式下载的,效率很低。 如果我取消了scriptmethod属性和类级别脚本,那么我无法从我的IPhone应用程序进行调用,因为它说我的方法调用需要scriptmethod属性。

如果有人可以建议使用objective-c从web服务下载图像到IPhone应用程序的最佳途径,我会永远感激

1 个答案:

答案 0 :(得分:5)

让网络服务返回图片网址,然后从网址下载图片。