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 6676929
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T04:03:14+00:00 2026-05-26T04:03:14+00:00

I am getting errors using a NSDictionary when trying to assign it’s contents to

  • 0

I am getting errors using a NSDictionary when trying to assign it’s contents to new variables/objects. Maybe this isn’t posible? I thought it would be. I’m also not sure if I can use non-Objective C specific objects in the dictionary. Can you?

NSDictionary *preProcessResult = [[NSDictionary alloc] initWithDictionary: [self preProcessing:testImage]];
IplImage* resultImage = [preProcessResult objectForKey:@"ResultImage"];
int numChars = [preProcessResult objectForKey:@"NumberChars"];
[preProcessResult release];

And here is the method I am calling to create the dictionary:

- (NSDictionary*) preProcessing: (IplImage*) testImage {

//do stuff to image

NSDictionary *testImage_andNumChars = [NSDictionary dictionaryWithObjectsAndKeys:resultImage, 
@"ResultImage", numChars, @"NumberChars", nil];

return testImage_andNumChars;
}

Is this not the correct way to handle this? The error I get when I create the dictionary is:

“Cannot convert ‘IplImage*’ to ‘objc_object*’ in argument passing”

and when I retrieve the dictionary elements I get:

“Cannot convert ‘objc_object*’ to ‘IplImage*’ in initialization” and “Invalid conversion from ‘objc_object*’ to ‘int’ “.

I’ve read the Apple docs on NSDictionary which got me this far, but I am not sure where to go from here.

Thanks in advance.

  • 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-26T04:03:15+00:00Added an answer on May 26, 2026 at 4:03 am

    Putting it shortly, NSDictionary values must be NSObjects.

    You should store int as NSNumber using e.g.:

    [NSNumber numberWithInt:numChars]
    

    When retrieving the value you can use e.g.:

    int numChars = [[preProcessResult objectForKey:@"NumberChars"] intValue];
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to resize the image using javascript, but I am getting errors
I am getting strange errors while trying to create a simple database using isql
I keep getting linker errors when I try to set this up. I'm using
I am trying to compile my code, but I am getting errors when using
I'm using GCC 4.3.3 on Ubuntu 9.04 64-bit and was getting errors using C++-style
My document is getting some errors when using the W3C validator because some of
Using an opencart plugin I am getting these errors in my apache error log
I'm using a 3rd party api to request balances. I'm getting numerous errors on
I'm getting a lot of errors compiling code using the boost libraries, mainly when
Upon using PKEY_Device_FriendlyName, I'm getting the following errors: Error 1 error LNK2001: unresolved external

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.