RLT
RLT

Reputation: 4287

Reading desktop plist

I am using following code to read the details of the plist,

NSString *plistPath = @"~/Library/Preferences/com.apple.desktop.plist";
NSDictionary *plistData = [NSDictionary dictionaryWithContentsOfFile:plistPath];

But plistData has no entries.

Is there something wrong in above code?

Upvotes: 1

Views: 108

Answers (1)

sergio
sergio

Reputation: 69047

You need expanding the tilde. Try this:

NSString * plistPath = [@"~/Library/Preferences/com.apple.desktop.plist" stringByExpandingTildeInPath];

Upvotes: 2

Related Questions