The default storage space of APDataCenter is the
/Documents/Preferences directory of the application sandbox. If the business is independent or the data amount is large, you can customize the storage space.
You can create your own storage directory by using APCustomStorage. You can use all services provided by Datacenter in this directory, which is similar to the APDataCenter. For example, you can run the following code to create the
APCustomStorage* storage = [APCustomStorage storageInDocumentsWithName:@"Contact"];
The directory contains both
commonPreferences which stores public data and
userPreferences which stores user-related data. APCustomStorage is similar to APDataCenter, so you don’t have to pay attention to user switching.
Create a custom storage with path as /Documents/name.
This method is usually not used for creating a custom storage at any specified path. The storageInDocumentsWithName can be used instead. The APCustomStorage created with this interface should be held by the yourself. When multiple APCustomStorages share the same path, errors will occur.
For the global storage objects irrevelant to users, access data by using the key-value method. Different from APDataCenter, for APCustomStorage, the business argument is not required for storing key-value data in the custom storage space of the business. Only the key is required.
For the global storage objects of login users, access data by using the key-value method. When the user is not logged-in, nil will be returned. Different from APDataCenter, for APCustomStorage, the business argument is not required for storing key-value data in the custom storage space of the business. Only the key is required.
For more information, see description of the APDataCenter class.