Question

Recently I use NSTimer to repeat taking photos, it'll show on the screen.

This is the problem:

I need to execute my app. & taking photos at the same time. So, does there any way to take photos at background?

I'll appreciate for any opinions~

Was it helpful?

Solution

Look into NSThread's detachNewThreadSelector:toTarget:withObject: method.

For example:

[NSThread detachNewThreadSelector:@selector(takePictures) toTarget:self withObject:nil];

Somewhere else in your class, you'd have:

- (void) takePictures {
   // insert code to take pictures...
}
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top