中文版本请参看这里
WCDB is an efficient, complete, easy-to-use mobile database framework used in the WeChat application. It's currently available on iOS, macOS and Android.
- WINQ (WCDB language integrated query): WINQ is a native data querying capability which frees developers from writing glue code to concatenate SQL query strings.
- ORM (Object Relational Mapping): WCDB provides a flexible, easy-to-use ORM for creating tables, indices and constraints, as well as CRUD through ObjC objects.
- Multi-threaded concurrency: WCDB supports concurrent read-read and read-write access via connection pooling.
- Encryption Support: WCDB supports database encryption via SQLCipher.
- Corruption recovery: WCDB provides a built-in repair kit for database corruption recovery.
- Anti-injection: WCDB provides a built-in protection from SQL injection.
- Apps using WCDB can target: iOS 8 or later, macOS 10.10 or later.
- Xcode 8.0 or later required.
- Objective-C++ required.
- Via Carthage:
- Install Carthage;
- Add
github "Tencent/WCDB"
to your Cartfile; - Run
carthage update
. - Drag
WCDB.framework
from the appropriate platform directory inCarthage/Build/
to theLinked Binary and Libraries
section of your Xcode project’sBuild Phases
settings; - On your application targets'
Build Phases
settings tab, click the "+" icon and chooseNew Run Script Phase
. Create a Run Script withcarthage copy-frameworks
and add the paths to the frameworks underInput Files
:$(SRCROOT)/Carthage/Build/iOS/WCDB.framework
or$(SRCROOT)/Carthage/Build/Mac/WCDB.framework
; - Add
#import <WCDB/WCDB.h>
at the top of your Objective-C++ source files and start your WCDB journey. - Since WCDB is an Objective-C++ framework, for those files in your project that includes WCDB, you should rename their extension
.m
to.mm
.
- Via Cocoapods:
- Install CocoaPods.
- Run
pod repo update
to make CocoaPods aware of the latest available WCDB versions. - In your Podfile, add
pod 'WCDB'
to your app target. - From the command line, run
pod install
. - Use the
.xcworkspace
file generated by CocoaPods to work on your project! - Add
#import <WCDB/WCDB.h>
at the top of your Objective-C++ source files and start your WCDB journey. - Since WCDB is an Objective-C++ framework, for those files in your project that includes WCDB, you should rename their extension
.m
to.mm
.
- Via source code:
- Getting source code from git repository. If cloning from git, submodules are required:
git submodule update --init --recursive
. - Drag
WCDB.xcodeproj
inwcdb/apple/
into your project; - Add
WCDB.framework
to theTarget Dependencies
section andLinked Binary and Libraries
of your Xcode project's `Build Phases" settings; - Add
WCDB.framework
to the "Enbedded Binaries" section of your Xcode project's "General" settings; - Add
#import <WCDB/WCDB.h>
at the top of your Objective-C++ source files and start your WCDB journey. - Since WCDB is an Objective-C++ framework, for those files in your project that includes WCDB, you should rename their extension
.m
to.mm
.
- Getting source code from git repository. If cloning from git, submodules are required:
Tutorials can be found here.