$ npm install react-native-txocr --save
$ react-native link react-native-txocr
##注意 1.github单个上传文件不能超过100M,请到react-native-txocr/ios/WBCloudReflectionFaceVerify/sdks下 将rapidnet_ios.framework.zip解压出来,或者自行下载sdk替换,否则IOS编译时会报错
- In XCode, in the project navigator, right click
Libraries
➜Add Files to [your project's name]
- Go to
node_modules
➜react-native-txocr
and addRNTxocr.xcodeproj
- In XCode, in the project navigator, select your project. Add
libRNTxocr.a
to your project'sBuild Phases
➜Link Binary With Libraries
- Run your project (
Cmd+R
)<
- Open up
android/app/src/main/java/[...]/MainActivity.java
- Add
import com.reactlibrary.RNTxocrPackage;
to the imports at the top of the file - Add
new RNTxocrPackage()
to the list returned by thegetPackages()
method
- Append the following lines to
android/settings.gradle
:include ':react-native-txocr' project(':react-native-txocr').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-txocr/android')
- Insert the following lines inside the dependencies block in
android/app/build.gradle
:compile project(':react-native-txocr')
- drag
react-native-txocr/ios/WBCloudReflectionFaceVerify/bundles/*
andreact-native-txocr/ios/WBCloudReflectionFaceVerify/sdks/*
all sdk and bundles to your project in xcode - open
Build Phases
➜Link Binary With Libraries
addUIKit.framework
AVFoundation.framework
MobileCoreServices.framework
CoreVideo.framework
Accelerate.framework
Security.framework
SystemConfiguration.framework
CoreMedia.framework
AudioToolbox.framework
CoreTelephony.framework
ImageIO.framework
WebKit.framework
libc++.tbd
andreact-native-txocr/ios/WBCloudReflectionFaceVerify/sdks/*
all sdk; - Open
Build Settings
➜Framework Search Paths
add$(SRCROOT)/../node_modules/react-native-txocr/ios/WBCloudReflectionFaceVerify/sdks
- Open
android/build.gradle
...
allprojects {
repositories {
.....
flatDir {
dirs project(':react-native-txocr').file('txocrlib')
} //ADD THIS
....
}
}
...
interface Params {
userId:string,
nonceStr:string,
sign:string,
appId:string,
orderNo:string,
version:string,
license:string,
name:string,
idCard:string,
ip:string,
}
interface Result {
isSuccess:boolean,
similarity:string,
liveRate:string,
image:string,
}
export default function ocr(params:Params): Promise<Result>