Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

johnmerlino

macrumors member
Original poster
Oct 22, 2011
81
0
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:

Code:
@interface Unit : NSObject
{
    @private
    NSString *name;
    NSUInteger *unit_id;
}
@property (weak, nonatomic)  NSString *name;
@property (assign, nonatomic)  NSUInteger *unit_id;


@end

This is the implementation:

Code:
#import "Unit.h"

@implementation Unit
@synthesize name = _name;
@synthesize unit_id;

@end

Not sure why the error occurs and what it is exactly trying to say.

Thanks for response
 

gnasher729

Suspended
Nov 25, 2005
17,980
5,565
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:

Code:
@interface Unit : NSObject
{
    @private
    NSString *name;
    NSUInteger *unit_id;
}
@property (weak, nonatomic)  NSString *name;
@property (assign, nonatomic)  NSUInteger *unit_id;


@end

This is the implementation:

Code:
#import "Unit.h"

@implementation Unit
@synthesize name = _name;
@synthesize unit_id;

@end

Not sure why the error occurs and what it is exactly trying to say.

Thanks for response

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*.
 

lee1210

macrumors 68040
Jan 10, 2005
3,182
3
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.

-Lee
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.