How to Implement One-Page Image Capture with User Interface
Note: Before you begin, see How to Add the Library to Your Xcode Project.
- Add the NSCameraUsageDescription and NSPhotoLibraryUsageDescription keys into the info.plist file for requesting access to the device’s camera and to the user’s photo library.
- Create an instance of the AUICaptureController interface for managing user interface and starting capture scenario. On this step you can use the properties of this interface to tune the user interface appearance and the settings of the camera.
- To get access to the processing mechanisms for the chosen scenario create an RTREngine object using the sharedEngineWithLicenseData: method. The method requires an NSData object containing your license data. For example, you can use dataWithContentsOfFile: to create a data object, then pass this object to the sharedEngineWithLicenseData: method.
- Create an instance of an interface inherited from the AUICaptureScenario for managing the capture scenario. Choose the inherited interface for the image capture scenario: AUIImageCaptureScenario interface. Pass the previously created RTREngine object as an input parameter to the constructor.
- Implement the delegate interface, corresponding to the scenario object, and its methods. I.e. for AUIImageCaptureScenarioDelegate interface you should implement these methods:
- The captureScenario:didCaptureImageWithResult: method returns the result image as a AUIImageCaptureResult object
- The captureScenario:didFailWithError: method delivers error messages
- The captureScenarioDidCancel: method notifies that the scenario was canceled.
- Add the instance of the interface as a delegate property of the AUIImageCaptureScenario object.
- Set the created scenario object as a captureScenario property of the AUICaptureController object. Scenario will start immediately at the camera start.
- If any error occurs while processing, the capture scenario becomes temporary passive and the paused property of the AUICaptureController object is set to true.
- Process the messages sent by scenario to the delegate object. The result will be delivered as an AUIImageCaptureResult object, storing the captured image.
3/2/2022 12:59:15 PM