[英]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. 我有一个用MonoTouch制作的iPhone / iPad应用程序,它已经在苹果商店里。 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.
尺寸可以从2-100 Mb变化。 I have tried several approaches:
我尝试了几种方法:
Using SOAP Web Services, sending the byte array: a) Sending the whole file. 使用SOAP Web服务,发送字节数组:a)发送整个文件。 Crashed.
坠毁。 b) Splitting in chunks of 1Mb.
b)分裂成1Mb块。 Crashed after 10-15 chunks (varies).
在10-15个块之后崩溃(变化)。
Using WebClient.UploadFile. 使用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.
大部分时间都使用小于5 Mb的较小文件,但它偶尔会崩溃,并且大于10-12 Mb的所有文件都会崩溃。 On the server, I have a aspx page that receives the information sent through a POST
在服务器上,我有一个aspx页面,它接收通过POST发送的信息
Here is the actual code from the 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. 我相信iPhone / iPad的内存容量会直接影响到这一点。
Does anybody has any recomendation or suggested approach that I should follow? 有没有人有我应该遵循的任何推荐或建议的方法?
Thanks in advance 提前致谢
Edgar Herrador 埃德加·赫拉多尔
I'd recommend using Streaming & Chunking. 我建议使用Streaming&Chunking。 You're probably exceeding the message size when passing large files.
传递大文件时,您可能超出了邮件大小。
Are you getting any exceptions ? 你有任何例外吗?
您是否尝试过WCF流媒体(http://msdn.microsoft.com/en-us/library/ms733742.aspx)?
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.