MRZData
MRZData is a result class that contains the parsed MRZ information.
Definition
Assembly: DynamsoftMRZScannerBundle.xcframework
- Objective-C
- Swift
@interface DSMRZData : NSObjectclass MRZData : NSObject
Properties
| Property | Type | Description |
|---|---|---|
firstName |
String | The first name of the user of the MRZ document. |
lastName |
String | The last name of the user of the MRZ document. |
sex |
String | The sex of the user of the MRZ document. |
issuingState |
String | The issuing state of the MRZ document. |
issuingStateRaw |
String | The raw ICAO issuing state code as it appears in the MRZ. |
nationality |
String | The nationality of the user of the MRZ document. |
nationalityRaw |
String | The raw ICAO nationality code as it appears in the MRZ. |
dateOfBirth |
String | The date of birth of the user of the MRZ document. |
dateOfExpire |
String | The expiry date of the MRZ document. |
documentType |
String | The type of MRZ document. |
documentNumber |
String | The MRZ document number. |
personalNumber |
String? | The personal number from the MRZ document, if available. |
optionalData1 |
String? | The first optional data field from the MRZ, if available. |
optionalData2 |
String? | The second optional data field from the MRZ, if available. |
age |
Int | The age of the user of the MRZ document. |
mrzText |
String | The raw text of the MRZ. |
firstName
The first name of the user of the MRZ document.
- Objective-C
- Swift
@property (nonatomic, readonly) NSString* firstName;let firstName: String
lastName
The last name of the user of the MRZ document.
- Objective-C
- Swift
@property (nonatomic, readonly) NSString* lastName;let lastName: String
sex
The sex of the user of the MRZ document.
- Objective-C
- Swift
@property (nonatomic, readonly) NSString* sex;let sex: String
issuingState
The issuing state of the MRZ document.
- Objective-C
- Swift
@property (nonatomic, readonly) NSString* issuingState;let issuingState: String
issuingStateRaw
The raw ICAO issuing state code as it appears in the MRZ (e.g. CAN, USA), before conversion to a full country name.
- Objective-C
- Swift
@property (nonatomic, readonly) NSString* issuingStateRaw;let issuingStateRaw: String
nationality
The nationality of the user of the MRZ document.
- Objective-C
- Swift
@property (nonatomic, readonly) NSString* nationality;let nationality: String
nationalityRaw
The raw ICAO nationality code as it appears in the MRZ (e.g. CAN, USA), before conversion to a full country name.
- Objective-C
- Swift
@property (nonatomic, readonly) NSString* nationalityRaw;let nationalityRaw: String
dateOfBirth
The date of birth of the user of the MRZ document.
- Objective-C
- Swift
@property (nonatomic, readonly) NSString* dateOfBirth;let dateOfBirth: String
dateOfExpire
The expiry date of the MRZ document.
- Objective-C
- Swift
@property (nonatomic, readonly) NSString* dateOfExpire;let dateOfExpire: String
documentType
The type of MRZ document.
- Objective-C
- Swift
@property (nonatomic, readonly) NSString* documentType;let documentType: String
documentNumber
The MRZ document number.
- Objective-C
- Swift
@property (nonatomic, readonly) NSString* documentNumber;let documentNumber: String
personalNumber
The personal number from the MRZ document. Returns nil if not present in the document.
- Objective-C
- Swift
@property (nonatomic, nullable, readonly) NSString* personalNumber;let personalNumber: String?
optionalData1
The first optional data field from the MRZ. Returns nil if not present in the document.
- Objective-C
- Swift
@property (nonatomic, nullable, readonly) NSString* optionalData1;let optionalData1: String?
optionalData2
The second optional data field from the MRZ. Returns nil if not present in the document.
- Objective-C
- Swift
@property (nonatomic, nullable, readonly) NSString* optionalData2;let optionalData2: String?
age
The age of the user of the MRZ document.
- Objective-C
- Swift
@property (nonatomic, readonly) int age;let age: Int
mrzText
The raw text of the MRZ.
- Objective-C
- Swift
@property (nonatomic, readonly) NSString* mrzText;let mrzText: String
Methods
| Method | Description |
|---|---|
getFieldValidationStatus |
Returns the validation status of a single parsed MRZ field. |
getFieldValidationStatus
Returns the validation status of a single parsed MRZ field. Most MRZ fields are protected by a check digit, and this method reports whether the value read from the document matched it.
A status of failed means the value does not agree with its check digit — the document may be misread, invalid, or altered. The value is still returned by the corresponding property, so you can choose whether to accept it, prompt for a re-scan, or ask for manual correction.
- Objective-C
- Swift
- (DSValidationStatus)getFieldValidationStatus:(NSString *)fieldName;func getFieldValidationStatus(_ fieldName: String) -> ValidationStatus
Parameters
fieldName: The name of the field to query, using the same names as the properties on this class. The accepted values are:
fieldName |
Corresponding property |
|---|---|
firstName |
firstName |
lastName |
lastName |
sex |
sex |
issuingState |
issuingState |
nationality |
nationality |
dateOfBirth |
dateOfBirth |
dateOfExpire |
dateOfExpire |
documentNumber |
documentNumber |
mrzText |
mrzText |
optionalData1 |
optionalData1 |
optionalData2 |
optionalData2 |
personalNumber |
personalNumber |
Return Value
A ValidationStatus value:
| Member | Value | Description |
|---|---|---|
DSValidationStatusNone / none |
0 | The field has no validation specified. |
DSValidationStatusSucceeded / succeeded |
1 | The validation for the field succeeded. |
DSValidationStatusFailed / failed |
2 | The validation for the field failed. |
ValidationStatus belongs to Dynamsoft Code Parser rather than to this SDK, and is imported from DynamsoftCaptureVisionBundle. See the ValidationStatus reference for its full definition.
dateOfBirth,dateOfExpireandmrzTextare composites of several underlying MRZ fields. Each returns the worst status among its components:failedif any component failed, otherwisesucceededif any component passed, otherwisenone.Because
mrzTextaggregates whole MRZ lines, it can reportfailedwhen no individual field does. This happens when the corruption falls in a field that carries no check digit of its own, such as name, nationality, or sex.
An unrecognized fieldName returns none rather than raising an error, as does any field for which no validation information was captured.