I am trying to set an image from a plist reading. I am working on an application that uses the current desktop wallpaper and sets it as a Windows background image. Files are located. ~/Library/Preferences/com.apple.desktop.plist
How to read the key to it? The specific keys I'm trying to read include:
NewImageFilePath
ImageFilePath
I tried this code, similar to reading plist on iPhone, but it did not work.
NSString *plistPath = @"~/Library/Preferences/com.apple.desktop.plist";
NSDictionary *plistData = [[NSDictionary dictionaryWithContentsOfFile:plistPath] retain];
NSString *item = [plistData objectForKey:@"NewImageFilePath"];
NSLog([NSString stringWithFormat:@"%@", item]);
Once I can get the actual data in the plists line, my plan is to set it to NSImageView or to a method [window setBackgroundColor:[color]];
Thanks in advance.
source
share