0

My app takes the NSData of movie objects and sends it over a network. The problem is, if the video is large enough, I'm worried my app will crash because of having so much data in memory. Is there a way to check the limits of the iPhone being used, so I can stop it transferring videos larger than that?

Andrew
  • 15,935
  • 28
  • 121
  • 203

3 Answers3

2

Your application will receive a memory warning when it is using too much memory. That is your only way of knowing. A view controller will get its didReceiveMemoryWarning method called. A UIApplicationDidReceiveMemoryWarningNotification event will also be raised.

borrrden
  • 33,256
  • 8
  • 74
  • 109
1

I dont think its right define a limit on the basis of memory available in the device. I would suggest you to upload file from disk. ASIHTTP has provision to stream file from disk. This will solve your memory problem.

Xcoder
  • 1,762
  • 13
  • 17
0

Even if you find out the amount of memory available on the current device, the system will start killing apps long before you allocate even a half of that amount. Can’t you simply choose a sensible safe block size and send the video in chunks?

zoul
  • 102,279
  • 44
  • 260
  • 354
  • I've just been considering this option. What would you consider a sensible safe block size? 20mb too much? – Andrew Mar 26 '13 at 10:25
  • I would go for the smallest size that doesn’t slow down the transfer. Probably start around 1 MB and see how that goes. – zoul Mar 26 '13 at 10:29