集成 1)、找到目标文件 http://39.96.8.150:10080/l405023944/Lenz.git Lenz->ios->SDK 将SDK文件目录copy至工程文件同级目录(即worksapce文件同级目录) 2)、podfile引入SDK(本地路径方式源码引入)
pod 'LenzCameraNativeModuleForRN', :path => './SDK/LenzCameraNativeModuleForRN'
3)、执行pod install
使用
1)、在需要使用到SDK能力的地方
#import "PCSBaseViewController.h"
2)、使用 1.初始化PCSBaseViewController initWithParams入参params及SDK回调 2.进入页面(push或present)由于该回调为异步线程,需回到主线程操作
if (!NSThread.isMainThread) {
dispatch_async(dispatch_get_main_queue(), ^{
PCSBaseViewController* controller = [PCSBaseViewController initWithParams:params complete:^(NSDictionary * _Nonnull dict) {
resolve(dict);
}];
controller.modalPresentationStyle = UIModalPresentationFullScreen;
// controller.semaphore = semaphore;
// __block NSMutableDictionary *event = [NSMutableDictionary dictionary];
// controller.completeBlock = ^(NSDictionary * _Nonnull dict) {
// };
[((AppDelegate*)([UIApplication sharedApplication].delegate)).window.rootViewController presentViewController:controller animated:YES completion:^{}];
});
}
cocoaPod集成(待完成) 1)pod 'LenzCameraNativeModuleForRN', '1.0.0' 2) 执行pod install
使用 方式同 一 (手动集成)
1.导入脚本 Podfile_ReactNative.rb 2.podfile 执行脚本
# 导入我们自定义的脚本
require_relative './Podfile_ReactNative'
# 执行我们编写的RN环境检测代码
installReactNativeSdk()
# 设置RN配置 依赖,这里需要注意,不要使用 ../node_modules/,而是../RNCode/node_modules/
require_relative './RNCode/node_modules/react-native/scripts/react_native_pods'
require_relative './RNCode/node_modules/@react-native-community/cli-platform-ios/native_modules'