安装指南
要将 MindBehind.framework 库添加到您的 XCode 工程中,请按照以下步骤安装框架
- 如果还没有安装,请先安装 CocoaPods
gem install cocoapods
- 将
MindBehind.framework
和MindBehind.podspec
文件复制到您的项目目录中某个位置,例如在vendor/MindBehind
中 - 在您的 Podfile 中添加 MindBehind 依赖,使用本地
path
切换到步骤 2 中的目录
target 'YourApp' do
pod 'MindBehind', :path => 'vendor/MindBehind'
end
- 安装 pod
pod install
- 打开生成的
.xcworkspace
文件,并添加以下键到您的应用 Info.plist 文件(如果需要请替换值)
<key>NSPhotoLibraryUsageDescription</key>
<string>${PRODUCT_NAME} will read your photo library to gather additional information</string>
<key>NSPhotoLibraryAddUsageDescription</key>
<string>${PRODUCT_NAME} will write to your photo library to gather additional information</string>
<key>NSCameraUsageDescription</key>
<string>${PRODUCT_NAME} will use your camera to gather additional information</string>
- 开始在您的代码中使用框架。
Objective-C
#import <MindBehind/MindBehind.h>
[MindBehind initWithSettings:[MBCSettings settingsWithIntegrationId:@"YOUR_INTEGRATION_ID"] completionHandler:^(NSError * _Nullable error, NSDictionary * _Nullable userInfo) {
// Your code after init is complete
}];
Swift
MindBehind.initWith(MBCSettings(integrationId: "YOUR_INTEGRATION_ID")) { (error: Error?, userInfo: [AnyHashable : Any]?) in
// Your code after init is complete
}