Hi guys and girls
I have a design question concerning synchronizing plists. My framework has a set a rules (you could call it preferences). The user may or may not change them (depending on the program that uses the framework). The application defaults are read from a plist from the mainbundle that uses the framework.
If the user is allowed to change them, I can register the defaults in NSUserDefaults in the "initialize" method of my class. In this case, synchronizing is dealt with by NSUserDefaults and the user can use any program to edit them.
The framework client then provides methods/GUI for editing the defaults.
But if the user is not allowed to edit, I should not expose the application defaults to the user and so there is no synchronization issue at all.
One way to combine both situations is to create a user plist in the application support directory and read this file if it exists or the plist in the mainbundle if not. But this creates a synchronization issue if the user is allowed to change the defaults. Changing the defaults do not have to occur in one central location, as is the case with preferences. What if one document changes the default? How do I tell the other documents? Reading the plist every time is one option, but this is probably inefficient.
Thanks for at least reading this far!
I have a design question concerning synchronizing plists. My framework has a set a rules (you could call it preferences). The user may or may not change them (depending on the program that uses the framework). The application defaults are read from a plist from the mainbundle that uses the framework.
If the user is allowed to change them, I can register the defaults in NSUserDefaults in the "initialize" method of my class. In this case, synchronizing is dealt with by NSUserDefaults and the user can use any program to edit them.
The framework client then provides methods/GUI for editing the defaults.
But if the user is not allowed to edit, I should not expose the application defaults to the user and so there is no synchronization issue at all.
One way to combine both situations is to create a user plist in the application support directory and read this file if it exists or the plist in the mainbundle if not. But this creates a synchronization issue if the user is allowed to change the defaults. Changing the defaults do not have to occur in one central location, as is the case with preferences. What if one document changes the default? How do I tell the other documents? Reading the plist every time is one option, but this is probably inefficient.
Thanks for at least reading this far!