Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 4545008
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T15:45:06+00:00 2026-05-21T15:45:06+00:00

I am trying to take EXIF data from the iPhone to calculate brightness. I

  • 0

I am trying to take EXIF data from the iPhone to calculate brightness. I need to access two specific NSNumber’s ExifExposureTime and ExifISOSpeed to be converted to floats, but when I try to convert them to floats I am getting this error:

“2011-04-21 17:38:31.776 POP[11910:207] -[__NSCFArray floatValue]: unrecognized selector sent to instance 0x4b48f70
2011-04-21 17:38:31.777 POP[11910:207] * Terminating app due to uncaught exception ‘NSInvalidArgumentException’, reason: ‘-[__NSCFArray floatValue]: unrecognized selector sent to instance 0x4b48f70’ “

Is there some silly mistake that I am missing? Please let me know. Below is my code:

-(IBAction)getDataOne:(id)sender {
    NSString *aPath = [[NSBundle mainBundle] pathForResource:@"IMG_0062" ofType:@"JPG"];

    NSURL *url = [NSURL fileURLWithPath:aPath];

    CGImageSourceRef sourceRef = CGImageSourceCreateWithURL((CFURLRef)url, NULL);

    NSDictionary *immutableMetadata = (NSDictionary *) CGImageSourceCopyPropertiesAtIndex(sourceRef,0,NULL);

    NSDictionary *exifDic = [immutableMetadata objectForKey:(NSString *)kCGImagePropertyExifDictionary];

    NSNumber *ExifApertureValue  = [exifDic objectForKey:(NSString*)kCGImagePropertyExifApertureValue];
    NSNumber *ExifShutterSpeed  = [exifDic objectForKey:(NSString*)kCGImagePropertyExifShutterSpeedValue];
    NSNumber *ExifExposureTime  = [exifDic objectForKey:(NSString*)kCGImagePropertyExifExposureTime];
    NSNumber *ExifFStop  = [exifDic objectForKey:(NSString*)kCGImagePropertyExifFNumber];
    NSNumber *ExifISOSpeed  = [exifDic objectForKey:(NSString*)kCGImagePropertyExifISOSpeedRatings];

    NSLog(@"ExifApertureValue : %@ \n",ExifApertureValue);
    NSLog(@"ExifShutterSpeed : %@ \n",ExifShutterSpeed);
    NSLog(@"ExifExposureTime : %@ \n",ExifExposureTime);
    NSLog(@"ExifFStop : %@ \n",ExifFStop);
    NSLog(@"ExifISOSpeed : %@ \n",ExifISOSpeed);

    float brightness, T, ISO;
    float K = 12.0;
    float A2 = 7.84;

    T = [ExifExposureTime floatValue];
    ISO = [ExifISOSpeed floatValue];

    brightness = (A2 * K) / (T * ISO);

    [summaryViewController imageOneSuccess];

    [ExifApertureValue release];
    [ExifShutterSpeed release];
    [ExifExposureTime release];
    [ExifFStop release];
    [ExifISOSpeed release];
}

Here is what outputs in those 5 NSLOG statements to show that there are valid values stored:

2011-04-21 18:05:12.318 POP[12051:207] ExifApertureValue : 2.526069 
2011-04-21 18:05:12.319 POP[12051:207] ExifShutterSpeed : 4.915926 
2011-04-21 18:05:12.321 POP[12051:207] ExifExposureTime : 0.03333334 
2011-04-21 18:05:12.323 POP[12051:207] ExifFStop : 2.4 
2011-04-21 18:05:12.324 POP[12051:207] ExifISOSpeed : (
    640
) 

UPDATE: I was looking at my outputs and noticed the ExifISOSpeed is printing in that weird:

(
640
)

format. That was what the problem was when I was converting to a float, but would anyone know why it is outputting in such a fashion? I am able to use if statements and determine if it is greater than 0 so I am able to see it as a number.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-21T15:45:06+00:00Added an answer on May 21, 2026 at 3:45 pm

    ExifISOSpeed is an NSArray and not a NSNumber.

    Try:

    NSNumber *ExifISOSpeed  = [[exifDic objectForKey:(NSString*)kCGImagePropertyExifISOSpeedRatings] objectAtIndex:0];
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to take up data from plist. One row in plist has
I am trying to take contacts from my addressbook. I am displaying the data
I'm trying to take a photo from my iPhone app and upload to a
I'm trying to take data from three different tables and output it using as
trying to take this content: <div class=content>one,two,three</div> <div class=content>four,five,six</div> <div class=content>seven,eight,nine</div> and .split and
net I am trying to take a value from a previous form typically in
So I'm trying to take a variable size (anywhere from a few MBs to
I'm trying to take a python class (in IronPython), apply it to some data
I am trying to take text from a list box control and put it
Trying to take in several file names from the user at the command line

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.