New To Mac-Forums?

Welcome to our community! Join the discussion today by registering your FREE account. If you have any problems with the registration process, please contact us!

Get your questions answered by community gurus Advice and insight from world-class Apple enthusiasts Exclusive access to members-only contests, giveaways and deals

Join today!

 
Start a Discussion
 

Mac-Forums Brief

Subscribe to Mac-Forums Brief to receive special offers from Mac-Forums partners and sponsors

Join the conversation RSS
OS X - Development and Darwin Discussion and questions about development for Mac OS X.

XCode (again) NSDictionary woes...


Post Reply New Thread Subscribe

 
Thread Tools
Raconteur

 
Member Since: Mar 10, 2010
Location: Burbank, CA
Posts: 10
Raconteur is on a distinguished road
Mac Specs: iMac i5 27" OSX 10.6.2

Raconteur is offline
Hi all,

Nethfel, I hope you catch this.

I have a NSDictionary with a handful of info in it represented as string keys and integer values. One item is "Difficulty Level", and it looks like this:
"Difficulty Level" => 2.

When I debug into my code and run "po" in the console, ala:
Code:
po settingsContent
I see:
Code:
"Difficulty Level" => 2
and if I do:
Code:
po [settingsContent objectForKey:@"Difficulty Level"]
I get 2, just as I would expect.

However... when I run the code:
Code:
- (int)difficultyLevel {
	int dl;
	
	if (settingsContent != nil)
		dl = [settingsContent objectForKey:@"Difficulty Level"];
	else
		dl = 0;
	
	return dl;
}
dl is some huge number.

What am I doing wrong??

Thanks!

Chris
QUOTE Thanks
Raconteur

 
Member Since: Mar 10, 2010
Location: Burbank, CA
Posts: 10
Raconteur is on a distinguished road
Mac Specs: iMac i5 27" OSX 10.6.2

Raconteur is offline
Ack... ok, so I am getting the data from a PList, which has the type declared as "Number," which is returning a reference to a NSNumber.

Adding intValue to the code that pulls the data from the dictionary solved it.

C
QUOTE Thanks

Post Reply New Thread Subscribe


« Add "shine" to my image? | recommended xCode and cocoa development guides »
Thread Tools

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
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
Trackbacks are On
Pingbacks are On
Refbacks are Off
Forum Jump

Similar Threads
Thread
Thread Starter
Forum
Replies
Last Post
content.yieldmanager.edgesuite.net XCODE nachohi88 Internet, Networking, and Wireless 1 03-27-2010 10:41 PM
Xcode, Subversion, and directory behaviour Reinderien OS X - Development and Darwin 1 03-10-2009 12:50 PM
Carbon framework on XCode Rafi Shalom OS X - Development and Darwin 1 04-17-2008 02:14 PM
Xcode 1.5 alejandrico OS X - Development and Darwin 0 06-03-2006 06:56 PM
New Xcode plug-in helps developers reuse code Murlyn OS X - Development and Darwin 0 11-10-2003 01:16 PM

All times are GMT -4. The time now is 07:05 PM.

Powered by vBulletin
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
X

Welcome to Mac-Forums.com

Create your username to jump into the discussion!

New members like you have made this community the ultimate source for your Mac since 2003!


(4 digit year)

Already a member?