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

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
thread Thread Starter Forum Replies Last Post
App Store constantly reminding me of an update to a delete app. Garrod Mac Basics and Help 0 Nov 19, 2011 08:39 AM
Showing beta versions of an app to a customer aneuryzma iPhone/iPad Programming 3 May 21, 2011 07:35 PM
setTitle - trying to set title of an NSWindow to contents of NSTextfield - failing glossywhite Mac Programming 2 Sep 8, 2009 04:29 PM
Very specific request: Cloning a MAC Address of an iPhone, to my MBP Muler36 Jailbreaks and iOS Hacks 5 Jan 8, 2009 02:25 PM
Getting the best sound out of an ipod to hook up to car stereo scubasteve3715 iPod 5 Nov 15, 2007 11:28 AM


All times are GMT -5. The time now is 10:24 PM.

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

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