Advertise Mobile SDKs Books Events Forum News Social Networking Support Us
Follow @iphonedevsdk on Twitter

Interface 2, Advanced iOS
Mockup & Code Gen
($9.99)

Make your own iPhone apps
and run them live!
(free)

Pic Frame Dynamo: Photo Editing
($0.99)

Abiliator
($1.99)

Want your application or service advertised on iPhone Dev SDK?

Go Back   iPhone Dev SDK Forum > iPhone SDK Development Forums > iPhone SDK Development

Reply
 
LinkBack Thread Tools Display Modes
Old 07-07-2010, 08:39 AM   #1 (permalink)
Registered Member
 
Join Date: Jul 2009
Posts: 172
raziiq is on a distinguished road
Default NSDictionary String not equal to NSString?

Hi there, i have this code

Code:
NSMutableDictionary *dict = [[NSMutableDictionary alloc] initWithContentsOfFile:pListFilePath];

		NSMutableDictionary *capabilities;
		capabilities = [dict valueForKey:@"capabilities"];
		
		NSString *value = [capabilities valueForKey:@"MyValue"];

		NSLog(@"%@",value);

		if ([value compare: @"1"] == NSOrderSame)
		{
			NSLog(@"Equal");
		}
		else 
		{
			NSLog(@"Not Equal");
		}
Now the problem is that the String "value" gets "1" from [capabilities valueForKey:@"MyValue"] and when i NSLog it, it displays "1" but it gives me an exception
Quote:
[NSCFString objCType]: unrecognized selector sent to instance 0x5158
2010-07-07 22:38:56.807 zToggle[2153:207] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[NSCFString objCType]: unrecognized selector sent to instance 0x5158'
means its giving me exception on if ([value compare: @"1"] == NSOrderSame)

Any suggestions??
raziiq is offline   Reply With Quote
Old 07-07-2010, 08:45 AM   #2 (permalink)
Registered Member
 
Join Date: Jul 2009
Posts: 172
raziiq is on a distinguished road
Default

BTW MyValue in plist is a Boolean
raziiq is offline   Reply With Quote
Old 07-07-2010, 08:58 AM   #3 (permalink)
Registered Member
 
Join Date: Jul 2009
Posts: 172
raziiq is on a distinguished road
Default

Got it working.

Here is the solution

Code:
BOOL value = [[capabilities objectForKey:@"multitasking"] boolValue];
Then check value for TRUE or FALSE
raziiq is offline   Reply With Quote
Reply

Bookmarks

Thread Tools
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
Trackbacks are On
Pingbacks are On
Refbacks are On



» Advertisements
» Online Users: 336
9 members and 327 guests
bignoggins, Chickenrig, firecall, givensur, iNet, michaelhansen, Objective Zero, PlutoPrime, stanny
Most users ever online was 1,387, 04-10-2012 at 04:21 AM.
» Stats
Members: 175,657
Threads: 94,118
Posts: 402,893
Top Poster: BrianSlick (7,990)
Welcome to our newest member, jenniead38
Powered by vBadvanced CMPS v3.1.0

All times are GMT -5. The time now is 12:33 AM.
Powered by vBulletin® Version 3.8.0
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.3.0