Managing a Camera Session

Before being able to do much with the camera, a session must first be opened.
//camera is an EOSCamera instance
//try to open session
if ([camera openSession:nil]){
    NSLog(@"Opened a camera session");

The session should be closed once it is no longer needed.
//is a session open?
if ([camera isOpen]){

    //close it
    [camera closeSession:nil];


Getting Properties

EOSCamera is a subclass of EOSPropertyObject, and therefore inherits methods that can be used to access properties of a camera. All of the properties that can be accessed are defined by the EOSProperty enumeration. For example, the camera's serial number can be retrieved as a string by using the following method:
//get serial number
NSString* serialNumber = [camera stringValueForProperty:EOSProperty_SerialNumber error:nil];

//print it
NSLog(@"Serial number: %@", serialNumber);

Numeric values can be retrieved using a similar method:
//get battery level
NSNumber* batteryLevel = [camera numberValueForProperty:EOSProperty_BatteryLevel error:nil];

//battery level is represented by a percentage, or -1 if AC powered
if ([batteryLevel integerValue] < 0){
    NSLog(@"Camera is AC powered");

    NSLog(@"Battery level: %@\%", batteryLevel);


Many property values are retrieved as numeric codes that are defined by property enumerations. For example, when retrieving the aperture, you will get an EOSAperture value such as EOSAperture_5_6, rather than a double value such as 5.6. To compare values, you will need to get the unsigned integer value:
//get a coded value, such as aperture
NSNumber* apertureNumber = [camera numberValueForProperty:EOSProperty_Aperture error:nil];

//get the EOSAperture (unsigned integer) value
EOSAperture* aperture = [apertureNumber unsignedIntegerValue];

//check whether aperture is auto
if (aperture == EOSAperture_Auto){

    NSLog(@"Aperture is auto");


You may want to use dictionaries to translate the codes into understandable values. Fortunately, EOSFramework comes with a set of such dictionaries. They can be found in the defaultDictionary object of the EOSDictionary class. The EOSDictionary class is not compiled into the framework - you will need to import the EOSDictionary.h and EOSDictionary.m files separately.
//get a coded value, such as aperture
NSNumber* aperture = [camera numberValueForProperty:EOSProperty_Aperture error:nil];

//get the default aperture dictionary
NSDictionary* apertureDictionary = [[EOSDictionary defaultDictionary] aperture];

//get the readable aperture value
NSString* apertureString = [apertureDictionary objectForKey:aperture];

//print it
NSLog(@"Aperture: %@", apertureString);

Setting Properties

Properties can be set by using a similar set of methods:
//set the artist's name, which is included in copyright metadata
[camera setStringValue:@"Bob" forProperty:EOSProperty_Artist error:nil];

//set the white balance and check for failure
if (![camera setNumberValue:EOSWhiteBalance_Auto forProperty:EOSWhiteBalance]){

    NSLog(@"Could not set white balance");


Getting Supported Values

For some properties, a list of values that are supported by the camera in its current mode can be retrieved. Each value in the list is represented by an NSNumber. The following shows an example of how to print a list of the supported shutter speed values, in readable form.
//get the supported shutter speed codes
NSArray* supportedValues = [camera supportedValuesForProperty:EOSProperty_ShutterSpeed error:nil];

//get the default shutter speed dictionary
NSDictionary* shutterSpeedDictionary = [[EOSDictionary defaultDictionary] shutterSpeed];

//loop through each value
for (NSNumber* value in supportedValues){

    //get the readable shutter speed value
    NSString* shutterSpeedString = [shutterSpeedDictionary objectForKey:value];

    //print it
    NSLog(@"%@ is supported", value);


Sending Commands

A camera can be sent any of the commands that are defined by the EOSCameraCommand enumeration. The following example shows how to take a picture.
//try to take a picture and check for failure
if (![camera sendCommand:EOSCameraCommand_TakePicture error:nil]){

    NSLog(@"Failed to take picture");