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

  • Home
  • SEARCH
  • 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 6143859
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T18:34:31+00:00 2026-05-23T18:34:31+00:00

How can i convert the key to an NSNumber? this code gives me the

  • 0

How can i convert the key to an NSNumber? this code gives me the error:

no matter how i try it, i always end up with the error: Incompatible integer to pointer conversion assigning to ‘NSNumber’ from ‘NSIntegar’ (aka ‘int’).

        for (id key in consultants)
    {
        consultantData = [[ConsultantData alloc] init];

        consultantData.name = [consultants objectForKey:key];
        consultantData.conID = [[NSNumber numberWithInteger:key] integerValue];

        NSLog(@"name: %@    ID: %@", consultantData.name, consultantData.conID);

        [consultantList addObject:consultantData];
        [consultantData release];
    }

here is my object ConsultantData:

#import <Foundation/Foundation.h>

@interface ConsultantData : NSObject 
{
    NSString *name;
    NSNumber *conID;
}

@property (nonatomic, retain) NSString *name;
@property (nonatomic, retain) NSNumber *conID;

@end

#import "ConsultantData.h"


@implementation ConsultantData

@synthesize name;
@synthesize conID;

-(void) dealloc
{
    [name release];
    [conID release];

    [super dealloc];
}

@end

if i try isMemberOfClass, it never returns true. if i try isKindOfClass, it tells me its a NSString.

consultants is a dictionary i receive from my sever that passes thru an XMLRPC function (server is PHP). from what i’ve seen, everything is a string in the server dictionary returns.

  • 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-23T18:34:31+00:00Added an answer on May 23, 2026 at 6:34 pm

    could be that you have the order wrong.

    consultantData.conID = [[NSNumber numberWithInteger:key] integerValue];
    

    means

    NSNumber *foo = [NSNumber numberWithInteger:key];
    NSInteger bar = [foo integerValue];
    consultantData.conID = bar;
    

    you probably want

    consultantData.conID = [NSNumber numberWithInteger:[key integerValue]];
    

    which is in verbose form:

    NSInteger foo = [key integerValue];
    NSNumber *bar = [NSNumber numberWithInteger:foo];
    consultantData.conID = bar;
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

How can I convert this RSA public key: 109120132967399429278860960508995541528237502902798129123468757937266291492576446330739696001110 6039072308886100726558188253585034290 57592827629436413108566029093628 2126359538366865626758497206207862794310902180176810615217550567108238764764442605581471797071 19674283982419152118103759076030616683978566631413 to
I have a value of key in file. How I can convert this value
How can I export the private key embedded in an .cer file and convert
You can convert a negative number to positive like this: int myInt = System.Math.Abs(-5);
we can convert character to an integer equivalent to the ASCII value of the
How i can convert to c# code files to html files?Is there any generation
How can I convert RSAPublicKey into something readable (public key sharing reasons) and then
How can I convert a Key (Key in KeyEventArgs) to a string. For example,
How can I convert My LINQ to SQL ? i have this LINQ statement:
How i can convert number 20020415 to date 15.04.2002. I am working in Microsoft

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.