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?
You need to use the UIImagePickerController class, basically:
UIImagePickerController
UIImagePickerController *picker = [[UIImagePickerController alloc] init]; picker.delegate = pickerDelegate picker.sourceType = UIImagePickerControllerSourceTypeCamera
The pickerDelegate object above needs to implement the following method:
pickerDelegate
- (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)
info
UIImagePickerControllerOriginalImage
UIImagePickerControllerEditedImage
2.1m questions
2.1m answers
60 comments
57.0k users