senojsitruc / wsdl2objc

Automatically exported from code.google.com/p/wsdl2objc
MIT License
0 stars 0 forks source link

Low memory crash with large files downloads #76

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. When using SOAP web service to download a large file on iPhone, you may 
have a low memory crash

-> Please provide a way to handle large responses by serializing to disk 
instead of memory

What version of the product are you using? On what operating system?
Version 0.6 on iPhone OS 3.1.3

Please provide any additional information below.

In order to solve the memory issue, check the total size of your 
NSMutableData object each time that new data is received. If the size is 
over, say, 1MB, then write the current data object to a file and clear the 
data. 

Each time the your data object reaches 1MB, just append the contents to the 
end of the same file.

Finally, when connectionDidFinish is called, just write the remaining data 
to the file, and youre done:

Templates/Binding_M.template

@implementation %«className»Operation

- (void)connection:(NSURLConnection *)connection didReceiveData:(NSData 
*)data
{
...
}

Thanks a lot for your fantastic work in providing an open source WSDL 
parser to the iPhone platform!

Original issue reported on code.google.com by boivin.jerome@gmail.com on 10 Mar 2010 at 9:20