Reputation: 78
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?
Upvotes: 0
Views: 601
Reputation: 78
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.
Upvotes: 1
Reputation: 60498
How about just putting a URL to the file in the response, then using HTTP or FTP to retrieve the actual file?
Upvotes: 0