简体   繁体   中英

How get File from web service for iPhone

i'm new to iPhone programming and web service too. I'm trying to get a file from a Rest web service written with c#, the service return a byte array, the file is 15Mb. I've try to many ways to get the file but if i get the file inside an XML response, i need to parse with NSXMLParser that make my application crash because alloc a string in memory and it also make the file bigger and i also need to convert on base 64.

How can i get the file without XML response?

I've found the solution. When i get the file, that is content in the node of the XML response, i save it on disk. Then with a NSFileHandle i jump after XML header and start to read the file with a while. I read 1MB each time, convert to Base64 and then write it to disk with another NSFileHandle.

I hope that is usefull for someone else.

仅在响应中添加URL到文件,然后使用HTTP或FTP检索实际文件怎么样?

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM