Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Access the camera with iOS

Tags:

ios

iphone

camera

It seems obvious that some people have been able to figure out how to access the iPhone camera through the SDK (Spore Origins, for example). How can this be done?

like image 623
Jason Francis Avatar asked Sep 16 '08 16:09

Jason Francis


People also ask

How do I give camera access to IOS?

Review or change access to the camera, microphone, and other hardware features. Go to Settings > Privacy. Tap a hardware feature, such as Camera, Bluetooth, Local Network, or Microphone.

How do I give Safari permission to access the camera on my iPhone?

Open the Settings app. Tap on Safari > Camera. Scroll down to Camera & Microphone. Confirm that "Ask" or "Allow" is checked.

How do I allow access to my camera?

Tap Site Settings. Tap Microphone or Camera. Tap to turn the microphone or camera on or off. Allow.


2 Answers

You need to use the UIImagePickerController class, basically:

UIImagePickerController *picker = [[UIImagePickerController alloc] init]; picker.delegate = pickerDelegate picker.sourceType = UIImagePickerControllerSourceTypeCamera 

The pickerDelegate object above needs to implement the following method:

- (void)imagePickerController:(UIImagePickerController *)picker            didFinishPickingMediaWithInfo:(NSDictionary *)info 

The dictionary info will contain entries for the original, and the edited image, keyed with UIImagePickerControllerOriginalImage and UIImagePickerControllerEditedImage respectively. (see https://developer.apple.com/documentation/uikit/uiimagepickercontrollerdelegate and https://developer.apple.com/documentation/uikit/uiimagepickercontrollerinfokey for more details)

like image 127
wxs Avatar answered Sep 26 '22 16:09

wxs


Hmmmm.....Ever tried using an OverlayView? With this the camera might look customized but in actuality its just a view above it.

If the private API's are directly accessed it might result in the app being rejected by Apple. See if the below link helps.

link text

like image 35
binshi Avatar answered Sep 24 '22 16:09

binshi