Accessing Other AppsDefaults

上一篇 / 下一篇  2008-01-28 11:15:54 / 个人分类:MAC

Well, it does...just not in a nice, neat format yet (see below). You can take your pick without worrying, though; Apple says that you can even mix CFPreferences and NSUserDefaults without harm. Also, you don't have to include the whole Carbon framework for this, just CoreFoundation (which may even already be included in the Cocoa framework).

NSDictionary *safariPrefs = [[NSUserDefaults standardUserDefaults] persistentDomainForName:@"com.apple.Safari"];
BOOL tabbedBrowsingEnabled  = [safariPrefs objectForKey:@"TabbedBrowsing"];
// ...
// If you want to set something, you have to do it like this, unfortunately,
// instead of modifying a specific value
[[
NSUserDefaults standardUserDefaults] setPersistentDomain:safariPrefs forName:@"com.apple.Safari"];

浏览方法
NSString *s;
NSEnumerator *e = [myDict keyEnumerator];
while (s = [e nextObject]) {
NSLog(@"key is %@, value is %@", s, [myDict objectForKey:s]);
}


TAG:

 

评分:0

我来说两句

显示全部

:loveliness: :handshake :victory: :funk: :time: :kiss: :call: :hug: :lol :'( :Q :L ;P :$ :P :o :@ :D :( :)

我的栏目

日历

« 2008-12-03  
 123456
78910111213
14151617181920
21222324252627
28293031   

数据统计

  • 访问量: 863
  • 日志数: 17
  • 文件数: 4
  • 建立时间: 2008-01-26
  • 更新时间: 2008-07-09

RSS订阅

Open Toolbar