Swift - Scanning with Ikscannerdeviceview on Osx

IKScannerDeviceViewDelegate never called

Apparently the following methods are not called:

func scannerDeviceView(IKScannerDeviceView!, didScanTo: ICScannerBandData!, scanInfo: [AnyHashable : Any]!, error: Error!)
func scannerDeviceView(IKScannerDeviceView!, didScanTo: URL!, error: Error!)

Implement the following method instead:

func scannerDeviceView(IKScannerDeviceView!, didScanTo: URL!, fileData: Data!, error: Error!)

Sample Image Capture with Scanner to Yosemite

Regarding that does not recognize your printer Yosemite , try the following
No more scanning after upgrading to MacOS X 10.10

func in swift for self causes error in Xcode

I found the problem. My delegate needs to declare its superclass which is NSObject... like so:

class myDeviceBrowserDelegate : NSObject, ICDeviceBrowserDelegate {
...

Then the self function (among others) was shown as overriding the protocol definition, so I was able to now just delete those functions. Actually, only the two first functions I must declare.

I found this link that helped explain the writing of a delegate in swift: https://medium.com/@agoiabeladeyemi/protocol-in-swift-with-practical-examples-8b955268ce39



Related Topics



Leave a reply



Submit