Catch error on multiple tries to connect to NFC
@@ -274,7 +274,15 @@ public final class IOSNFCCard extends AbstractNFCCard {
@Override
public void didDetectTags(NFCTagReaderSession session, NSArray<?> tags) {
for (NSObject t : tags) {
- session.connectToTag(t, (NSError er) -> {
+ session.connectToTag(t, (NSError err) -> {
+
+ if (err != null) {
+ synchronized (tagLock) {
+ error = err;
+ setTag(null);
+ tagLock.notifyAll();
+ }
+ } else {
NFCISO7816Tag tag = session.getConnectedTag().asNFCISO7816Tag();
synchronized (tagLock) {
@@ -282,6 +290,7 @@ public final class IOSNFCCard extends AbstractNFCCard {
setDialogMsg(cfg.getDefaultCardRecognizedMSG());
tagLock.notifyAll();
}
+ }
});
}
