我正在使用以下代码来读取 plist 的详细信息,
NSString *plistPath = @"~/Library/Preferences/com.apple.desktop.plist";
NSDictionary *plistData = [NSDictionary dictionaryWithContentsOfFile:plistPath];
但是 plistData 没有条目。
上面的代码有问题吗?
最佳答案
您需要扩展波浪号。试试这个:
NSString * plistPath = [@"~/Library/Preferences/com.apple.desktop.plist" stringByExpandingTildeInPath];
关于cocoa - 读取桌面plist,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6818499/