Finally, I was able to figure out how to use IKScannerDeviceView.
The following delegates should be implemented in your class:
IKScannerDeviceViewDelegate, ICScannerDeviceDelegate, ICDeviceBrowserDelegate
and you need to have IKScannerDeviceView in your window with its delegate set to a class that implements IKScannerDeviceViewDelegate
To start using it, you must create an ICDeviceBrowser like this:
ICDeviceBrowser *mDeviceBrowser = [[ICDeviceBrowser alloc] init]; mDeviceBrowser.delegate = self; mDeviceBrowser.browsedDeviceTypeMask = ICDeviceLocationTypeMaskLocal|ICDeviceLocationTypeMaskRemote|ICDeviceTypeMaskScanner; [mDeviceBrowser start];
Then we implement the delegate methods in a manner similar to this:
- (void)scannerDeviceDidBecomeAvailable:(ICScannerDevice*)scanner; { [scanner requestOpenSession]; } - (void)deviceBrowser:(ICDeviceBrowser*)browser didAddDevice:(ICDevice*)addedDevice moreComing:(BOOL)moreComing { if ( (addedDevice.type & ICDeviceTypeMaskScanner) == ICDeviceTypeScanner ) { [scannerView setScannerDevice:(ICScannerDevice*)addedDevice]; } } -(void)didRemoveDevice:(ICDevice*)removedDevice { [removedDevice requestCloseSession]; }
Then, if everything is correct, your IKScannerDeviceView will be able to interact with your scanner!
source share