I am creating a binding library for binding the Objective-C framework.
I have the following delegate, which should add it to the ApiDefinition file, and then I need to implement it using my Xamarin.iOS application:
- (void)Initialize:(id <MMSDKDelegate> _Nullable)pDelegate;
MMSDKDelegate:
@protocol MMSDKDelegate <IMMDelegate> - (void)Started; @end
IMMDelegate:
@protocol IMMDelegate - (void)Inserted; - (void)Removed; - (void)ReaderConnected; - (void)ReaderRemoved; @end
I need the required definition in the ApiDefinition file, and I need some sample code to call this method from my Xamarin.iOS application.
Update
The frame I'm dealing with communicates with the iPhone attached to read the ID card information, it has methods called on the reader, inserted / deleted, and the card inserted / removed.
I implemented the answer by @ cole-xia, but the problem is that the methods inside IMMDelegate never called when inserting a card reader or identifier. When I call ReadCardData() , it should call Started() , which will display the information saved with Inserted() , but the current result is that after calling ReadCardData() , the Started() method is called, but Inserted() and ReaderConnected() never called at any stage.
In the demo Framework application, it is used as follows (and works correctly):
// Demo app -> ViewController.m @interface ViewController () <MMSDKDelegate> @end @implementation ViewController { MMSDK *sdkInstance; } - (void)viewDidAppear:(BOOL)animated { [super viewDidAppear:animated]; sdkInstance = [MMSDK SharedInstance]; [sdkInstance Initialize:self]; } - (void)Started { // Update UI by: reading in progress .. } - (void)Inserted { // Update UI by: card inserted // And read card data [self readData:self]; } - (void)Removed { // Update UI by: card removed } - (void)ReaderConnected { // Update UI by: card reader connected } - (void)ReaderRemoved { // Update UI by: card reader removed } - (IBAction)readData:(id)sender { var *data = [sdkInstance ReadCardData:YES pWithSignatureImage:YES pWithAddressData:YES]; if (data.hasError) { // No data fetched return; } if (data) { // return card data } }
All suggestions are welcome and appreciated.
In general, I just need to do the same functionality of the demo application in the Xamarin.iOS application.