views:

199

answers:

2

Hi there. I am trying to figure out how to use the UIIMagePicker or some way to use the iPhone 4's Backlight LED. I am trying to use a UIView with a button on it to turn the LED on & off without showing any video. Is this even possible? Any help?

EDIT

I've been using AVCaptureDevice class or at least trying to. When it comes to importing #import It tells me it isnt valid.

The code I am trying to use is http://twitpic.com/23lv9v

+2  A: 

You have to enable the camera for that. Look at the AVCaptureDevice Class and possibly AVCaptureTorchMode and AVCaptureFlashMode.

Shaji
There's no need to even show the video when you're using the AVCaptureDevice, let along place a UIView over it.
Tom Irving
Thank you very much. I am going to have to takew a look at this.
Magician Software
A: 

you need to set [videoCaptureDevice lockForConfiguration:nil]; then you can turn on the torch...

See the docs: http://developer.apple.com/iphone/library/documentation/AVFoundation/Reference/AVCaptureDevice_Class/Reference/Reference.html

Gustavo Barrientos
I see. Ill try that when I get home later on :)Thanks
Magician Software
BTW! I tried your code in my XCode, in Simulator the code crashes, but, i tried in the device mode, and it works!.
Gustavo Barrientos
Hey Gustavo Barrientos.Mine builds now but crashes when I click the button getting SIGBART
Magician Software
runs on the Simulator? or in the iDevice?try checking the hasTorch.
Gustavo Barrientos