Matching String With ObjectForKey?
Matching String With ObjectForKey?
- Subject: Matching String With ObjectForKey?
- From: Chunk 1978 <email@hidden>
- Date: Fri, 13 Feb 2009 01:45:46 -0500
how can i equate an NSString to an ObjectForKey (which is also an
NSString)? kinda driving me crazy.
-=-=-=-
NSString *desktopPlist =
[@"~/Library/Preferences/com.apple.desktop.plist"
stringByExpandingTildeInPath];
NSString *originalDesktopBackgroundImage = [[[[NSDictionary
dictionaryWithContentsOfFile: desktopPlist]
objectForKey:@"Background"] objectForKey:@"default"]
objectForKey:@"ImageFilePath"];
NSLog(originalDesktopBackgroundImage);
NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
[defaults setObject:originalDesktopBackgroundImage
forKey:@"OriginalBackground"];
NSString *pathy = @"/Library/Desktop Pictures/Nature/Aurora.jpg";
if ([defaults objectForKey:@"OriginalBackground"] == pathy)
{
NSLog(@"Same");
}
else
{
NSLog(@"Not Same");
}
-=-=-=-
so i'm getting the path of the current desktop background and setting
it to the defaults. the current desktop image in the Aurora image.
my IF statement isn't working as i am expecting. the output reads:
-=-=-=-
2009-02-13 01:44:51.911 Test[33576:10b] /Library/Desktop
Pictures/Nature/Aurora.jpg
2009-02-13 01:44:51.913 Test[33576:10b] Not Same
-=-=-=-
but they are the same! aren't they?!
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden