iOS安全的数据库:ApolloDB

jopen 9年前


这是一个易于实现,用于在iOS App中安全得存储数据的数据库。

Installation

Simply copy the files to your project and add the frameworkJavaScriptCore.framework. Then import the fileApolloDB.hto the classes in which you will use ApolloDB.

Usage

It's simple, first of all to start a session, you must use the following code anywhere but before saving or getting an object from the DB.

BOOL passcodeIsValid = [[ApolloDB sharedManager]startSessionWithPasscode:@"yourDBPasscode"]; //Set a passcode for encrypting and decrypting your DB  if (passcodeIsValid==false){  //The given passcode is different from the DB passcode  }

Before starting the session, you can use any of the following methods for setting or getting an object from the DB. Remember that for saving custom classes as objects you must configure theencodeWithCoderandinitWithCodermethods of the class.
[[ApolloDB sharedManager]setObject:@"foo" forKey:@"bar"]; //Set an object for a key  [[ApolloDB sharedManager]setObjects:@[@"foo", @"testing"] forKeys:@[@"bar", @"status"]]; //Set objects for the specified keys  [[ApolloDB sharedManager]removeObjectForKey:@"bar"]; //Remove the object corresponding to the specified key  [[ApolloDB sharedManager]removeObjectsForKeys:@[@"bar", @"status"]]; //Remove the objects corresponding to the specified keys  [[ApolloDB sharedManager]objectForKey:@"bar"]; //Get the object corresponding to the specified key  [[ApolloDB sharedManager]objectsForKeys:@[@"bar", @"status"]]; //Get the objects corresponding to the specified keys  NSDictionary *myData = [[ApolloDB sharedManager]allData]; //Get all the DB data

项目主页:http://www.open-open.com/lib/view/home/1440574529325