準備工作請查看上篇文章
iOS配置
1、下載iOS 有動作版本SDK
下載下來的的壓縮包解壓後是這樣的:
2、用xcode 把FaceSDK裏面的文件導入到iOS項目
添加完之後是這樣的
3、確認下Bundle Identifier 是否是申請license時填報的那一個
申請授權時填寫的Bundle ID 必須和蘋果開發者中心的Bundle ID 一致
4、選擇鏈接C++標準庫。
5、如果沒有使用pod管理第三方庫的話,請在Build Setting >Linking > Other Linker Flags 上面加入 –ObjC 選項。如果用了pod請忽略,因爲pod會自動添加上。
6、集成RN橋接文件
把FaceParameterConfig.h
裏面的授權license信息改成自己的,我們下載下來的SDK就有這些信息,直接把這個文件內容拷貝過去即可。
添加完之後是這樣的:
最後,在項目的 AppDelegate.m 文件中添加SDK的初始化代碼 
#import "IDLFaceSDK/IDLFaceSDK.h"
#import "FaceParameterConfig.h"
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
.....省略
NSString* licensePath = [[NSBundle mainBundle] pathForResource:FACE_LICENSE_NAME ofType:FACE_LICENSE_SUFFIX];
NSAssert([[NSFileManager defaultManager] fileExistsAtPath:licensePath], @"license文件路徑不對,請仔細查看文檔");
[[FaceSDKManager sharedInstance] setLicenseID:FACE_LICENSE_ID andLocalLicenceFile:licensePath];
NSLog(@"canWork = %d",[[FaceSDKManager sharedInstance] canWork]);
.....省略
self.window = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds];
UIViewController *rootViewController = [UIViewController new];
rootViewController.view = rootView;
self.window.rootViewController = rootViewController;
[self.window makeKeyAndVisible];
return YES;
}
7、配置頭文件路徑
8、配置編譯項
如果不配置這些編譯項,會報如下錯誤:
如果遇到React-native, “Native module cannot be null”
那說明,配置沒配置對。
React Native 使用
看上一篇文章