UIImagePickerController

Let’s dive into the hardware of the iPhone and iPad, both of which now have a camera.

UIImagePickerController
The default use of a camera in iOS applications is the UIImagePickerController. You can take pictures from the Photo Library, Saved Photos, or Camera itself.
There are certain steps you need to take when you want to implement UIImagePickerController into your apps. First off, you need to check the source availability. Some devices do not have cameras, and thus this step is crucial (although Apple does check for you as well, it is good to check it yourself to be sure). Next step is to set the source type, which is where you want to select the photos from, be it the camera or photo library or saved photos. After which, you would want to set properties such as the media types, photo or video. Finally, you assign the delegate to yourself and present the controller modally. Take note that these controllers are always modally presented.

//Check source availability
if ([UIImagePickerController isSourceTypeAvailable: UIImagePickerControllerSourceTypeCamera])
{
//Create UIImagePickerController
UIImagePickerController* picker = [[UIImagePickerController alloc] init];

//Set image picker source
picker.sourceType = UIImagePickerControllerSourceTypeCamera;

//Set image picker media types
picker.mediaTypes = [NSArray arrayWithObjects: (NSString *) kUTTypeMovie, (NSString *) kUTTypeImage, nil];

//Set image picker delegate
picker.delegate = self;

//Present image picker
[self presentModalViewController:picker animated:YES];
}

* Add MobileCoreServices.framework or
 #import <MobileCoreServices/UTCoreTypes.h>

First off, we check the source availability by calling isSourceTypeAvailable. Next we create the UIImagePickerController, set the source and mediaTypes. For mediaTypes we create an array that includes both Movie and Image, in this case. Make sure you add the MobileCoreServices framework and import the UTCoreTypes file first.
Finally, we set the delegate to the view controller and present it modally.

There are many properties you might want to take note of while writing for your iOS apps, such as whether to use the rear or front camera, the quality of media, and whether you want to use flash or not.


UIImagePickerControllerDelegate
After implementing all of the above, you still need to implement the delegate methods as well. Your final images or videos will be stored in an NSDictionary that is returned in the imagePickerController didFinishPickingMediaWithInfo. Here is where you would want to store the images somewhere, and then dismiss the controller. There’s also a cancel method if the user chose to cancel taking a photo instead.

Contains your original and edited images (save them!)
- (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info; 

Dismiss controller here
- (void)imagePickerControllerDidCancel:(UIImagePickerController *)picker;

After implementing all of the above, you still need to implement the delegate methods as well. Your final images or videos will be stored in an NSDictionary that is returned in the imagePickerController didFinishPickingMediaWithInfo. Here is where you would want to store the images somewhere, and then dismiss the controller. There’s also a cancel method if the user chose to cancel taking a photo instead.

Saving Media
To save media, we have to use the following methods, UIImageWriteToSavedPhotosAlbum, and UISaveVideoAtPathToSavedPhotosAlbum. For videos, you need to check if the path is compatible to be saved in.

UIImageWriteToSavedPhotosAlbum

Optional completion callback 
UIVideoAtPathIsCompatibleWithSavedPhotosAlbum 
UISaveVideoAtPathToSavedPhotosAlbum


Augmented Reality
If you want to use augmented reality in your apps, you definitely can. The few properties that you should be looking at are showsCameraControls, cameraOverlayView, and cameraViewTransform. A third party kit that was recently developed is available for free to incorporate into your apps at www.iphonear.org.

ARKit (http://www.iphonear.org)
showsCameraControls
cameraOverlayView 
cameraViewTransform