Get Started
Requirements
osp_selfie SDK requires iOS 11 or newer.
Resource
Installation
osp_selfie is available through CocoaPods. To install it, simply add the following line to your Podfile:
pod 'osp_selfie'
Integration
- The OSP SDK lets you securely and seamlessly collect your user's information
pod 'Moya'
pod 'PromiseKit'
pod 'SwiftMessages'
Usage
Register
/**
name: The NodeType you want to register.
node: The instance of nodeable.
*/
OneStopManager.default.registerNode(name: .selfie, node: SelfieNode.init())
Note
The start and end node already supported by SDK, but you need manual specify selfie、document、or format node according to your demand.The NodeType euum:
enum NodeType: String {
case start
case selfie
case document
case format
case end
}
NodeType & Nodeable class map:
NodeType | class |
---|---|
selfie | SelfieNode |
document | DocumentNode |
format | coming |
Start a workflow
Generate SDK Token
The first step is to obtain a sdkToken, which is a necessary parameter to start the process. A quick access is provided in the demo to obtain the sdkToken. In your environment, this parameter needs to be obtained from your server.
Note:
Here is the example of sandbox environment
curl --location --request POST 'https://sandbox-oop-api.advai.net/intl/openapi/sdk/v2/trans/start' \
--header 'X-ADVAI-KEY: XXXX' \
--header 'journeyId: xxx' \
--header 'Content-Type: application/json' \
--data '{
"referenceId": "123213123",
}'
/**
token: Generate SDK Token step
context: The current UIViewController, this context.naviationController cannt be nil
*/
public func ex_start(token: String, context: UIViewController)
Callback
name | params | decription |
---|---|---|
onReady | start | |
onFinish | status:true,false | |
onExit | nodeType: string | User actively ends the process |
onError | ||
onEvent | eventName:String,params:[string: string] |
eventName & params
name | params |
---|---|
start | |
document_country_select | country: String |
document_type_select | type:string |
document_camera_capture | type:front,back,unknow |
document_upload | type:front,back,unknow |
selfie_camera_capture | type:2D,3D |
selfie_photo_upload | type:2D,3D |
enable_camera | source:document,selie |
retry | source:document,selie |
failure | source:document,selie |
load_camera_failed | |
form | |
form_submit | status:success,fail |
decline | |
success | |
pending |
You can call this method to listen for an event, example:
/**
des: you can call this method multiple times
type: CallBackType
*/
public func subscribe(type: CallBackType, _ act: @escaping (CallBackData?) -> Void)
or
public func subScribe(types: [CallBackType], _ act: @escaping (CallBackData?) -> Void)
ipa Volume
Using selfie single node, the ipa package size will increase by 7.3M.
License
osp_selfie is available under the MIT license. See the [LICENSE file](https://github.com/aai-osp-fe/aai-osp-ios-sdk-selfie?tab=MIT-1-ov-file)
for more info.
Updated 12 months ago