SCPreferencesPathSetValue doesn't update preferences data?

Discussion in 'Mac Programming' started by youngplayer, Jul 14, 2008.

  1. youngplayer macrumors member

    Joined:
    May 16, 2008
    Location:
    Shanghai,China
    #1
    I'm going to change the network's settings by my codes. I've read the sample code of MoreSCF. and I've set my user as root. and the SCPreferencesPathSetValue returns 'true'! But it doesn't modify the data file, for it doesn't modified when I check the value by "System Preferences".

    some of my codes:
    SCPreferencesRef gPrefsRef = SCPreferencesCreate(NULL,CFSTR("MyApp"),NULL);

    SCPreferencesLock(gPrefsRef,true);

    // format path; eg. "/sets/<setID>/Network/Service/<serviceID>"

    CFMutableDictionary propertyList = SCPreferencesPahtGetValue(gPrefsRef,path);

    // change propertyList

    SCPreferencesPathSetValue(gPrefsRef,path,propertyList/*modified*/);

    SCPreferencesCommitChanges(gPrefsRef);

    SCPreferencesApplyChanges(gPrefsRef);

    SCPreferencesUnlock(gPrefsRef);
     
  2. youngplayer thread starter macrumors member

    Joined:
    May 16, 2008
    Location:
    Shanghai,China
    #2
    Help....

    Anybody familiar with the Preferences Modification???
     

Share This Page