我已经安装了MMLanScan pod,一切正常, 但是当我开始扫描局域网时,出现错误:
2019-01-29 14:33:50.166202+0100 JapoApps[439:42146] *** Terminating app due to uncaught exception 'NSRangeException', reason: '*** -[__NSArrayM objectAtIndexedSubscript:]: index 0 beyond bounds for empty array'
*** First throw call stack:
(0x1f9c38ec4 0x1f8e09a50 0x1f9bb0494 0x1f9b33c68 0x10105a83c 0x10105b44c 0x10105afa0 0x1fa6ca790 0x101e2f824 0x101e30dc8 0x101e341c4 0x101e33604 0x101e421dc 0x101e42bc8 0x1f985517c 0x1f9857cec)
libc++abi.dylib: terminating with uncaught exception of type NSException
我不知道问题出在哪里以及如何调试它。
//协议功能
func lanScanDidFindNewDevice(_ device: MMDevice!) {
print(device.ipAddress)
}
func lanScanDidFinishScanning(with status: MMLanScannerStatus) {
print(status)
}
func lanScanDidFailedToScan() {
print("FAIL")
}
//我的代码
var lanscanner : MMLANScanner!
override func viewDidLoad() {
super.viewDidLoad()
lanscanner = MMLANScanner(delegate: self)
lanscanner.start()
}