0
我在我的應用程序中添加了一個進度條。一切都很好,按我想要的方式運行。但問題是當我在didReceivedData中追加下載的數據時,我的responseData被重新分配,從而使我的應用程序消耗太多內存。然後在收到MemoryMemory後崩潰。NSMutableData appendData:獲得重新分配,內存問題
-(void)connection:(NSURLConnection *)connection didReceiveData:(NSData *)data
{
//response data is getting reallocated with bigger size of data
[responseData appendData:data];
NSNumber* curLength = [NSNumber numberWithLong:[responseData length] ];
float progress = [curLength floatValue]/[filesize floatValue] ;
progressView.progress = progress;
}
有人可以幫助我如何擺脫我的responseData中的重新分配嗎?
謝謝!!!
您沒有在創建/重新分配responseData的地方顯示代碼。顯示。 – 2012-01-03 14:47:00