FAQ
iOS FAQ
How to set Datacenter to user mode?
Solution: The applications that access mPaaS use their own account system. If you want to use Datacenter to manage the user-mode data, you need to inform Datacenter the first time, so Datacenter can switch the user database, and then inform other business layers.
[[APDataCenter defaultDataCenter] setCurrentUserId:userId];
When you log out, you don’t have to call setCurrentUserId method, and Datacenter continues to open the previous user’s database, without any impact.
How to set the default encryption key?
Solution: Datacenter provides default encryption method, and the key is automatically generated by using the appKey that is passed in with mPaasInit method. It is suggested that the applications accessing mPaaS use their own keys.
Implement the following methods of mPaasAppInterface interface, and pass the key to Datacenter in the form of NSData.
#pragma mark Datacenter
/**
* To implement this method, you must return the encryption key (32 bytes) that is used by Datacenter by default. You can let this key be managed by the application with Security Guard, or encrypt and obfuscate the key, and then write it in the client.
* It is feasible to not to implement the method. Datacenter uses mPaaS and appKey to calculate a result, and uses the result as the encryption key with adequate security.
*
* @return 32-byte key, which is placed in NSData
*/
- (NSData*)appDataCenterDefaultCryptKey;It is suggested that each application generates its own 32-byte key, converts the key to Base64 string, and saves it in Security Guard. In this method, the string is extracted through the static interface of Security Guard, and reversely parsed to NSData.
Is Datacenter thread-safe?
Solution: Yes, all the data storage interfaces of Datacenter ar thread-safe. You can call them in any threads.