0
CoreNFC具有用于误差存在一个委托方法:iOS 11 CoreNFC如何处理读取错误?
//Called when the NFC session invalidates with an error.
- (void)readerSession:(nonnull NFCNDEFReaderSession *)session didInvalidateWithError:(nonnull NSError *)error {
}
的文档(https://developer.apple.com/documentation/corenfc)示出了该误差部分(https://developer.apple.com/documentation/corenfc/nfcreadererror)一堆错误代码。
我希望能够读取来自读取器会话的错误,并将其放入switch语句中,以便我可以输出每个错误的不同消息。我无法弄清楚如何从函数中获取这些错误信息。我假设我在基础目标c上遗漏了某些东西。
我希望得到的是这样的东西。
switch (error) {
case NFCReaderErrorSecurityViolation:
//Do Stuff
break;
case NFCReaderErrorUnsupportedFeature:
//NFC is unsupported.
break;
//ETC
default:
break;
}
我该怎么做?