关键是使用SQLCipher,→GitHub地址git
1、添加SQLCipher到项目中github
使用CocoaPod:数据库
pod 'EncryptedCoreData', :git => 'https://github.com/project-imas/encrypted-core-data.git'
2、在 AppDelegate.m 添加 测试
#import "EncryptedStore.h"
3、替换coordinator
加密
NSPersistentStoreCoordinator *coordinator = [EncryptedStore makeStore:[self managedObjectModel] passcode:@"你的密码"];
具体还有几个用法,在GitHub主页能够看到.spa
Mac如何查看使用SQLCipher加密数据库文件:
.net
仍是在GitHub,SqliteDatabaseViewer
code