• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Matching String With ObjectForKey?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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

  • Follow-Ups:
    • Re: Matching String With ObjectForKey?
      • From: "John C. Randolph" <email@hidden>
    • Re: Matching String With ObjectForKey?
      • From: Volker in Lists <email@hidden>
  • Prev by Date: [SOLVED] Re: NSTextView and keyDown: in the responder chain
  • Next by Date: Re: Matching String With ObjectForKey?
  • Previous by thread: Re: Chnaging icon of running app
  • Next by thread: Re: Matching String With ObjectForKey?
  • Index(es):
    • Date
    • Thread