Search code examples
iphonecamera

How can I take a photo frequently with iPhone?


Are there any ways to take a photo automatically with iPhone? eg. I need to take 20 pics in 30 sec! Is it possible?


Solution

  • If you are not gonna do it by writing your own application. There's no way you can do that!!!

    First, taking photos frequently as you described needs private apis. That will make your app rejected from App Store. If that's okay, read the instructions below.

    1. Dump headers of a Private Library called 'PhotoLibrary'.

    2. Setup your project in XCode.

    3. Add [[PLCameraController sharedInstance] previewView] to your UIWindow, in applicationDidFinishLaunching:.

    4. Create a NSTimer, repeats every (30/20) secs.

    5. In the timer's callback, run

      UIImage *image = [[PLCameraController sharedInstance] _createPreviewImage];

    6. Then you will get a UIImage every 1.5 second. Do whatever you need to do. You might need to save them to Photo Album by calling UIImageWriteToAlbum().

    Notice: This will only take photos of a low resolution. It's impossible to take full resolution photo per 1.5 second.