Copy 300MB Data From Server To iPhone
i want to copy large data ie... around 1400 files around 500 MB from web server to iphone documents directory. it is taking more than hour .some how i want to开发者_如何学JAVA reduce the time taken for coping file.
i m using code:
NSData *data=[NSData dataWithContentsOfURL:[NSURL URLWithString:someURL]];
if([data writeToFile:self.documentsDirectory atomically:YES])
NSLog(@"File Copied");
i m using above code in for loop till no of file ends. can some one suggest a better way??? i had tried NSOperationQueue and CFFTPURL but doesnot improve performance significantly.
Are you doing this on wifi ? either way turn the data into an archive using tar/zip etc... before transport. It is a known fact that sending multiple files over a network is orders of magnitudes slower than concatenating the objects first.
精彩评论