Implicit conversion of an Objective-C to 'NSUInteger *' (aka 'unsigned int *') is dis

Discussion in 'Mac Programming' started by johnmerlino, Nov 10, 2011.

  1. johnmerlino macrumors member

    Oct 22, 2011
    Hey all,

    I get his message:

    Implicit conversion of an Objective-C to 'NSUInteger *' (aka 'unsigned int *') is disallowed with ARC

    with this line right here:

    Unit *unit = [[Unit alloc] init];
    unit.unit_id = [dict objectForKey:mad:"id"];

    THis is the header:

    @interface Unit : NSObject
        NSString *name;
        NSUInteger *unit_id;
    @property (weak, nonatomic)  NSString *name;
    @property (assign, nonatomic)  NSUInteger *unit_id;
    This is the implementation:

    #import "Unit.h"
    @implementation Unit
    @synthesize name = _name;
    @synthesize unit_id;
    Not sure why the error occurs and what it is exactly trying to say.

    Thanks for response
  2. gnasher729 macrumors P6


    Nov 25, 2005
    It's telling you that your code is badly wrong.
    Whatever is in a dictionary cannot be an NSUInteger*.

    So either you messed up when you tried to put an NSUInteger* into a dictionary, or you are messing up when you try to store a pointer to an NSObject into an NSUInteger*.
  3. lee1210 macrumors 68040


    Jan 10, 2005
    Dallas, TX
    You're confused about what an NSUInteger is. It is not an NSObject, like NSNumber. It is typedef'd to a primitive value. This means it can't be used in containers that require an NSObject, and you would normally not need a pointer to one (there are reasons, this is not one). If you need a number that's an NSObject, try NSNumber.


Share This Page