Help with iOS app crashing with “Out Of Memory”
I have an iPhone/iPad application made in MonoTouch, which is already in the apple store. However there's still an issue that hasn't been completely solved. I need to be able to upload large files to our servers. Sizes can vary from 2-100 Mb in size. I have tried several approaches:
Using SOAP Web Services, sending the byte array: a) Sending the whole file. Crashed. b) Splitting in chunks of 1Mb. Crashed after 10-15 chunks (varies).
Using WebClient.UploadFile. Works most of the time with smaller files < 5 Mb, but every now and then it crashes and everything larger than 10-12 Mb crashes. On the server, I have a aspx page that receives the information sent through a POST
Here is the actual code from t开发者_Python百科he device:
WebClient wc = new WebClient ();
string sLFN = sLocalFileName;
FileInfo fi = new FileInfo (sLFN)
string sUri = getUri ();
byte [] f = wc.UploadFile (sUri, sLFN)
I believe that the memory capacity of the iPhone / iPad is something that directly affects this.
Does anybody has any recomendation or suggested approach that I should follow?
Thanks in advance
Edgar Herrador
I'd recommend using Streaming & Chunking. You're probably exceeding the message size when passing large files.
Are you getting any exceptions ?
Have you tried WCF streaming (http://msdn.microsoft.com/en-us/library/ms733742.aspx)?
精彩评论