Register FAQ / Rules Forum Spy Search Today's Posts Mark Forums Read
Go Back   MacRumors Forums > Apple Systems and Services > Programming > Mac Programming

Reply
 
Thread Tools Search this Thread Display Modes
Old Nov 10, 2011, 04:13 PM   #1
johnmerlino
macrumors member
 
Join Date: Oct 2011
Implicit conversion of an Objective-C to 'NSUInteger *' (aka 'unsigned int *') is dis

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:@"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
johnmerlino is offline   0 Reply With Quote
Old Nov 10, 2011, 04:42 PM   #2
gnasher729
macrumors G5
 
gnasher729's Avatar
 
Join Date: Nov 2005
Quote:
Originally Posted by johnmerlino View Post
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:@"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*.
gnasher729 is offline   1 Reply With Quote
Old Nov 10, 2011, 06:21 PM   #3
lee1210
macrumors 68040
 
lee1210's Avatar
 
Join Date: Jan 2005
Location: 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
lee1210 is offline   0 Reply With Quote

Reply
MacRumors Forums > Apple Systems and Services > Programming > Mac Programming

Tags
assign, nsuinteger, property

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Similar Threads
thread Thread Starter Forum Replies Last Post
bootcamp and unsigned drivers windows 8.1 Dekard Windows, Linux & Others on the Mac 0 Nov 20, 2013 05:53 PM
iPad: UIImage to Hex Conversion in Objective C Sherihan iOS 5 and earlier 0 Jul 21, 2013 11:06 AM
Silly Signed / Unsigned question larswik Mac Programming 8 Jan 5, 2013 01:39 PM
iPhone: iPhone 4s 5.0 to 5.1.1 (unsigned firmware) betito477 Jailbreaks and iOS Hacks 2 Sep 25, 2012 07:39 AM
C++ Overloading - How do I call (int, ...) instead of (int, int, ...)? ArtOfWarfare Mac Programming 7 Jun 18, 2012 04:00 PM

Forum Jump

All times are GMT -5. The time now is 02:22 PM.

Mac Rumors | Mac | iPhone | iPhone Game Reviews | iPhone Apps

Mobile Version | Fixed | Fluid | Fluid HD
Copyright 2002-2013, MacRumors.com, LLC