简体   繁体   中英

Find out how much memory an iPhone has?

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?

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.

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.

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?

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM