开发者

CFPreferences for another (or all) users

开发者 https://www.devze.com 2023-01-01 00:50 出处:网络
I\'m working on a background service which needs to ask several users\' iTunes settings (the users will opt-in via a helper application which they run from their login). Is there an easy way to read t

I'm working on a background service which needs to ask several users' iTunes settings (the users will opt-in via a helper application which they run from their login). Is there an easy way to read the preferences for another user, th开发者_运维知识库an the current one, using CFPreferences ? The docs, for example for CFPreferencesCopyValue, explicitly state: 'Do not use arbitrary user and host names, instead pass the pre-defined domain qualifier constants.', when passing the 'userName' argument to the various functions.


The userName parameter in CFPreferencesCopyValue is somewhat misleading; the possible values are restricted to the following ones:

- kCFPreferencesAnyUser;
- kCFPreferencesCurrentUser;

It specifies the scope of the preferences you are accessing (either current user or all users). This also means that you cannot access preference of another user, even if you run as root.

0

精彩评论

暂无评论...
验证码 换一张
取 消