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?
Asked
Active
Viewed 238 times
3 Answers
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
- 32,952
- 8
- 73
- 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,752
- 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
- 99,674
- 42
- 250
- 346
-
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