-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
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 12.0 or later, macOS 10.13 or later, WatchOS 4.0 or later.
- Xcode 15.0 or later.
-
Via CocoaPods:
- Install CocoaPods;
- Open the terminal,
cd
to your project directory, runpod repo update
to 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
.xcworkspace
file 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,
cd
to your project directory, runcarthage update
; - Drag
MMKV.framework
from the appropriate platform directory inCarthage/Build/
to theLinked Binary and Libraries
section of your Xcode project’sBuild Phases
settings; - On your application target's
Build Phases
settings 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.xcodeproj
iniOS/MMKV/
into your project; - Add
MMKV.framework
to theEmbedded Binaries
section 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 isMMKV
whileMMKV Static
is used for static lib. - Accordingly replace the
MMKV.framework
withMMKVAppextension.framework
for AppExtension, andMMKVWatchExtension.framework
for 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_CRYPT
inCore/MMKVPredef.h
to 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.xcodeproj
iniOS/MMKV/
into your project; - Add
MMKV Static
to theTarget Dependencies
section of your Xcode project'sBuild Phases
settings; - Add
libMMKV Static.a
,libz.tbd
to theLinked Binary and Libraries
section of your Xcode project'sBuild Phases
settings; - Add
-ObjC
to theOther Linker Flags
section 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_CRYPT
inCore/MMKVPredef.h
to 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