2011-07-25 50 views
1

我使用下面的代碼來讀取plist中的細節,閱讀桌面的plist

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

但plistData沒有入口。

上面的代碼有問題嗎?

回答

2

您需要擴大代字號。試試這個:

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