-
-
Notifications
You must be signed in to change notification settings - Fork 2k
iOS_setup
MMKV is an efficient, small, easy-to-use mobile key-value storage framework used in the WeChat application. It's currently available on both Android, iOS/macOS, Windows and POSIX.
- Apps using MMKV can target: iOS 13.0 or later, macOS 10.15 or later, WatchOS 6.0 or later.
-
Via CocoaPods:
- Install CocoaPods;
- Open the terminal,
cdto your project directory, runpod repo updateto make CocoaPods aware of the latest available MMKV versions; - Edit your Podfile, add
pod 'MMKV'to your app target, orpod 'MMKVAppExtension'for AppExtension target, orpod 'MMKVWatchExtension'for your WatchExtension target. - Run
pod install; - Open the
.xcworkspacefile generated by CocoaPods; - Add
#import <MMKV/MMKV.h>to your source file and we are done, replace with<MMKVAppExtension/MMKV.h>and<MMKVWatchExtension/MMKV.h>accordingly for other extension targets.
-
Via Carthage:
- Install Carthage;
- Edit your Cartfile, add
github "Tencent/MMKV"; - Open the terminal,
cdto your project directory, runcarthage update; - Drag
MMKV.frameworkfrom the appropriate platform directory inCarthage/Build/to theLinked Binary and Librariessection of your Xcode project’sBuild Phasessettings; - On your application target's
Build Phasessettings tab, click the "+" icon and chooseNew Run Script Phase. Create a Run Script withcarthage copy-frameworks, add the paths to the framework underInput Files:$(SRCROOT)/Carthage/Build/iOS/MMKV.framework, and add the paths to the copied frameworks to theOutput Files:$(BUILT_PRODUCTS_DIR)/$(FRAMEWORKS_FOLDER_PATH)/MMKV.framework; - Add
#import <MMKV/MMKV.h>to your source file and we are done.
Note: Carthage has trouble building multi schemes. If you want to use MMKV in AppExtensions, you should choose other methods.
-
Via Dynamic Framework:
- Getting source code from the git repository:
git clone https://github.com/Tencent/MMKV.git
- Drag
MMKV.xcodeprojiniOS/MMKV/into your project; - Add
MMKV.frameworkto theEmbedded Binariessection of your Xcode project'sGeneral settings; Note that there are two frameworks here and the dynamic one should be chosen. You can check it atBuild Phases->Target Dependencies. The right one isMMKVwhileMMKV Staticis used for static lib. - Accordingly replace the
MMKV.frameworkwithMMKVAppextension.frameworkfor AppExtension, andMMKVWatchExtension.frameworkfor WatchExtension. - Add
#import <MMKV/MMKV.h>to your source file and we are done.
Note: If you are pretty sure that encryption is not needed, you can turn on the preprocess directive
MMKV_DISABLE_CRYPTinCore/MMKVPredef.hto save some binary size. - Getting source code from the git repository:
-
Via Static Framework:
- Getting source code from git repository:
git clone https://github.com/Tencent/MMKV.git
- Drag
MMKV.xcodeprojiniOS/MMKV/into your project; - Add
MMKV Staticto theTarget Dependenciessection of your Xcode project'sBuild Phasessettings; - Add
libMMKV Static.a,libz.tbdto theLinked Binary and Librariessection of your Xcode project'sBuild Phasessettings; - Add
-ObjCto theOther Linker Flagssection of your Xcode project'sBuild Settings. - Add
#import <MMKV/MMKV.h>to your source file and we are done. - If you want to use MMKV for AppExtensions, you should link them as dynamic frameworks as written above.
Note: If you are pretty sure that encryption is not needed, you can turn on the preprocess directive
MMKV_DISABLE_CRYPTinCore/MMKVPredef.hto save some binary size. - Getting source code from git repository:
MMKV is published under the BSD 3-Clause license. For details check out the LICENSE.TXT.
Check out the CHANGELOG.md for details of change history.
If you are interested in contributing, check out the CONTRIBUTING.md, also join our Tencent OpenSource Plan.
To give clarity of what is expected of our members, MMKV has adopted the code of conduct defined by the Contributor Covenant, which is widely used. And we think it articulates our values well. For more, check out the Code of Conduct.
Check out the FAQ first. Should there be any questions, don't hesitate to create issues.
User privacy is taken very seriously: MMKV does not obtain, collect or upload any personal information. Please refer to the MMKV SDK Personal Information Protection Rules for details.
- In English
- 中文
- In English
- 中文
- In English
- 中文
-
In English
-
中文
-
Golang
- In English
- 中文